From c967d8e6e90fc48c1e25051ef457fe954e9983b1 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Tue, 16 Oct 2012 07:29:13 +0000 Subject: 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 --- polly/lib/CodeGen/LoopGenerators.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'polly/lib/CodeGen/LoopGenerators.cpp') 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(); 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()); -- cgit v1.2.3