aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms
diff options
context:
space:
mode:
authorNadav Rotem <nrotem@apple.com>2013-01-25 18:34:09 +0000
committerNadav Rotem <nrotem@apple.com>2013-01-25 18:34:09 +0000
commitf8c2f90bb3c70ab1830b44da990bda499f1e65d1 (patch)
treeaffb7792d998edfd868246fa831cbc701532fdc7 /lib/Transforms
parent172d5978c835377307f80b2845f1f11276f5ec24 (diff)
downloadexternal_llvm-f8c2f90bb3c70ab1830b44da990bda499f1e65d1.zip
external_llvm-f8c2f90bb3c70ab1830b44da990bda499f1e65d1.tar.gz
external_llvm-f8c2f90bb3c70ab1830b44da990bda499f1e65d1.tar.bz2
Refactor some code to use the IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173467 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index 0996b7b..0302bbf 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -941,29 +941,30 @@ InnerLoopVectorizer::addRuntimeCheck(LoopVectorizationLegality *Legal,
}
}
+ IRBuilder<> ChkBuilder(Loc->getContext());
+ ChkBuilder.SetInsertPoint(Loc);
+
for (unsigned i = 0; i < NumPointers; ++i) {
for (unsigned j = i+1; j < NumPointers; ++j) {
Instruction::CastOps Op = Instruction::BitCast;
- Value *Start0 = CastInst::Create(Op, Starts[i], PtrArithTy, "bc", Loc);
- Value *Start1 = CastInst::Create(Op, Starts[j], PtrArithTy, "bc", Loc);
- Value *End0 = CastInst::Create(Op, Ends[i], PtrArithTy, "bc", Loc);
- Value *End1 = CastInst::Create(Op, Ends[j], PtrArithTy, "bc", Loc);
-
- Value *Cmp0 = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_ULE,
- Start0, End1, "bound0", Loc);
- Value *Cmp1 = CmpInst::Create(Instruction::ICmp, CmpInst::ICMP_ULE,
- Start1, End0, "bound1", Loc);
- Instruction *IsConflict = BinaryOperator::Create(Instruction::And, Cmp0,
- Cmp1, "found.conflict",
- Loc);
- if (MemoryRuntimeCheck)
- MemoryRuntimeCheck = BinaryOperator::Create(Instruction::Or,
- MemoryRuntimeCheck,
- IsConflict,
- "conflict.rdx", Loc);
- else
- MemoryRuntimeCheck = IsConflict;
-
+ Value *Start0 = ChkBuilder.CreateCast(Op, Starts[i], PtrArithTy, "bc");
+ Value *Start1 = ChkBuilder.CreateCast(Op, Starts[j], PtrArithTy, "bc");
+ Value *End0 = ChkBuilder.CreateCast(Op, Ends[i], PtrArithTy, "bc");
+ Value *End1 = ChkBuilder.CreateCast(Op, Ends[j], PtrArithTy, "bc");
+
+ Value *Cmp0 = ChkBuilder.CreateICmp(CmpInst::ICMP_ULE,
+ Start0, End1, "bound0");
+ Value *Cmp1 = ChkBuilder.CreateICmp(CmpInst::ICMP_ULE,
+ Start1, End0, "bound1");
+ Value *IsConflict = ChkBuilder.CreateBinOp(Instruction::And, Cmp0, Cmp1,
+ "found.conflict");
+ if (MemoryRuntimeCheck) {
+ Value *B = ChkBuilder.CreateBinOp(Instruction::Or, MemoryRuntimeCheck,
+ IsConflict, "conflict.rdx");
+ MemoryRuntimeCheck = cast<Instruction>(B);
+ } else {
+ MemoryRuntimeCheck = cast<Instruction>(IsConflict);
+ }
}
}