aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Vectorize/LoopVectorize.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-01-25 19:43:15 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-01-25 19:43:15 +0000
commit5ac70a3804148749a15edf6113867a8bdae12974 (patch)
tree97c04abecaf6a77075494e28aee6f242482c0bb9 /lib/Transforms/Vectorize/LoopVectorize.cpp
parent3f16858579fdf7ee1cc6823736c68cede6643da1 (diff)
downloadexternal_llvm-5ac70a3804148749a15edf6113867a8bdae12974.zip
external_llvm-5ac70a3804148749a15edf6113867a8bdae12974.tar.gz
external_llvm-5ac70a3804148749a15edf6113867a8bdae12974.tar.bz2
LoopVectorize: Simplify code. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173475 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize/LoopVectorize.cpp')
-rw-r--r--lib/Transforms/Vectorize/LoopVectorize.cpp43
1 files changed, 17 insertions, 26 deletions
diff --git a/lib/Transforms/Vectorize/LoopVectorize.cpp b/lib/Transforms/Vectorize/LoopVectorize.cpp
index f53f57c..060b06a 100644
--- a/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -941,30 +941,23 @@ InnerLoopVectorizer::addRuntimeCheck(LoopVectorizationLegality *Legal,
}
}
- IRBuilder<> ChkBuilder(Loc->getContext());
- ChkBuilder.SetInsertPoint(Loc);
+ IRBuilder<> ChkBuilder(Loc);
for (unsigned i = 0; i < NumPointers; ++i) {
for (unsigned j = i+1; j < NumPointers; ++j) {
- Instruction::CastOps Op = Instruction::BitCast;
- 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);
- }
+ Value *Start0 = ChkBuilder.CreateBitCast(Starts[i], PtrArithTy, "bc");
+ Value *Start1 = ChkBuilder.CreateBitCast(Starts[j], PtrArithTy, "bc");
+ Value *End0 = ChkBuilder.CreateBitCast(Ends[i], PtrArithTy, "bc");
+ Value *End1 = ChkBuilder.CreateBitCast(Ends[j], PtrArithTy, "bc");
+
+ Value *Cmp0 = ChkBuilder.CreateICmpULE(Start0, End1, "bound0");
+ Value *Cmp1 = ChkBuilder.CreateICmpULE(Start1, End0, "bound1");
+ Value *IsConflict = ChkBuilder.CreateAnd(Cmp0, Cmp1, "found.conflict");
+ if (MemoryRuntimeCheck)
+ IsConflict = ChkBuilder.CreateOr(MemoryRuntimeCheck, IsConflict,
+ "conflict.rdx");
+
+ MemoryRuntimeCheck = cast<Instruction>(IsConflict);
}
}
@@ -1063,12 +1056,10 @@ InnerLoopVectorizer::createEmptyLoop(LoopVectorizationLegality *Legal) {
// This is the IR builder that we use to add all of the logic for bypassing
// the new vector loop.
- IRBuilder<> BypassBuilder(OldBasicBlock->getContext());
- BypassBuilder.SetInsertPoint(BypassBlock->getTerminator());
+ IRBuilder<> BypassBuilder(BypassBlock->getTerminator());
// We may need to extend the index in case there is a type mismatch.
// We know that the count starts at zero and does not overflow.
- unsigned IdxTyBW = IdxTy->getScalarSizeInBits();
if (Count->getType() != IdxTy) {
// The exit count can be of pointer type. Convert it to the correct
// integer type.
@@ -1090,8 +1081,8 @@ InnerLoopVectorizer::createEmptyLoop(LoopVectorizationLegality *Legal) {
// Now, compare the new count to zero. If it is zero skip the vector loop and
// jump to the scalar loop.
- Value *Cmp = BypassBuilder.CreateICmp(CmpInst::ICMP_EQ, IdxEndRoundDown,
- StartIdx, "cmp.zero");
+ Value *Cmp = BypassBuilder.CreateICmpEQ(IdxEndRoundDown, StartIdx,
+ "cmp.zero");
BasicBlock *LastBypassBlock = BypassBlock;