diff options
author | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-10-16 07:29:13 +0000 |
---|---|---|
committer | Tobias Grosser <grosser@fim.uni-passau.de> | 2012-10-16 07:29:13 +0000 |
commit | c967d8e6e90fc48c1e25051ef457fe954e9983b1 (patch) | |
tree | c523e09e1e2261785c86a3930335cff031ddbe47 /polly/lib/CodeGen/LoopGenerators.cpp | |
parent | 38e2496497b591db7d1c11d8f78ccff9efb71429 (diff) | |
download | bcm5719-llvm-c967d8e6e90fc48c1e25051ef457fe954e9983b1.tar.gz bcm5719-llvm-c967d8e6e90fc48c1e25051ef457fe954e9983b1.zip |
isl-codegen: Support '<' and '>'
Previously isl always generated '<=' or '>='. However, in many cases '<' or '>'
leads to simpler code. This commit updates isl and adds the relevant code
generation support to Polly.
llvm-svn: 166020
Diffstat (limited to 'polly/lib/CodeGen/LoopGenerators.cpp')
-rw-r--r-- | polly/lib/CodeGen/LoopGenerators.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp index 2b7e58d76e8..4edd01d81ac 100644 --- a/polly/lib/CodeGen/LoopGenerators.cpp +++ b/polly/lib/CodeGen/LoopGenerators.cpp @@ -25,7 +25,8 @@ using namespace polly; Value *polly::createLoop(Value *LB, Value *UB, Value *Stride, IRBuilder<> &Builder, Pass *P, - BasicBlock *&AfterBlock) { + BasicBlock *&AfterBlock, + ICmpInst::Predicate Predicate) { DominatorTree &DT = P->getAnalysis<DominatorTree>(); Function *F = Builder.GetInsertBlock()->getParent(); LLVMContext &Context = F->getContext(); @@ -57,7 +58,7 @@ Value *polly::createLoop(Value *LB, Value *UB, Value *Stride, // Exit condition. Value *CMP; - CMP = Builder.CreateICmpSLE(IV, UB); + CMP = Builder.CreateICmp(Predicate, IV, UB); Builder.CreateCondBr(CMP, BodyBB, AfterBB); DT.addNewBlock(BodyBB, HeaderBB); @@ -286,7 +287,8 @@ Value *OMPGenerator::createSubfunction(Value *Stride, Value *StructData, Builder.CreateBr(CheckNextBB); Builder.SetInsertPoint(--Builder.GetInsertPoint()); - IV = createLoop(LowerBound, UpperBound, Stride, Builder, P, AfterBB); + IV = createLoop(LowerBound, UpperBound, Stride, Builder, P, AfterBB, + ICmpInst::ICMP_SLE); BasicBlock::iterator LoopBody = Builder.GetInsertPoint(); Builder.SetInsertPoint(AfterBB->begin()); |