diff options
| author | Andrew Trick <atrick@apple.com> | 2011-11-02 00:02:45 +0000 |
|---|---|---|
| committer | Andrew Trick <atrick@apple.com> | 2011-11-02 00:02:45 +0000 |
| commit | 0dae890346e355c8bbe24d17ae33fa77a81e87be (patch) | |
| tree | faaecb1e7d9f265d5d928fa9a60e57d7ab0ad104 | |
| parent | 82ed3be1fb92beacc57195fa0e00ccd2ae7f986c (diff) | |
| download | bcm5719-llvm-0dae890346e355c8bbe24d17ae33fa77a81e87be.tar.gz bcm5719-llvm-0dae890346e355c8bbe24d17ae33fa77a81e87be.zip | |
Broaden an assert to handle enable-iv-rewrite=true following r143183.
Narrowest possible fix for PR11279.
llvm-svn: 143522
| -rw-r--r-- | llvm/lib/Transforms/Scalar/IndVarSimplify.cpp | 2 | ||||
| -rw-r--r-- | llvm/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll | 38 |
2 files changed, 39 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp index dce7f87e2c2..b2ccb2270ed 100644 --- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp +++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp @@ -1588,7 +1588,7 @@ LinearFunctionTestReplace(Loop *L, assert(SE->isLoopInvariant(IVLimit, L) && "Computed iteration count is not loop invariant!"); - assert( !IVLimit->getType()->isPointerTy() && + assert( EnableIVRewrite || !IVLimit->getType()->isPointerTy() && "Should not expand pointer types" ); Value *ExitCnt = Rewriter.expandCodeFor(IVLimit, CmpTy, BI); diff --git a/llvm/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll b/llvm/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll new file mode 100644 index 00000000000..050c169a2a4 --- /dev/null +++ b/llvm/test/Transforms/IndVarSimplify/2011-11-01-lftrptr.ll @@ -0,0 +1,38 @@ +; RUN: opt < %s -indvars -S -enable-iv-rewrite=true | FileCheck %s +; +; PR11279: Assertion !IVLimit->getType()->isPointerTy() +; +; Test a non-integer BECount. It doesn't make sense, but that's what +; falls out of SCEV. Since it's an i8*, we never adjust in a way that +; would convert it to an integer type. +; +; enable-iv-rewrite=false does not currently perform LFTR when the the +; taken count is a pointer expression, but that will change son. + +target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" +target triple = "x86_64-apple-darwin" + +; CHECK: @test8 +; CHECK: loop: +; CHECK: icmp ne +define i8 @test8(i8* %buf, i8* %end) nounwind { + br label %loopguard + +loopguard: + %guard = icmp ult i8* %buf, %end + br i1 %guard, label %preheader, label %exit + +preheader: + br label %loop + +loop: + %p.01.us.us = phi i8* [ %buf, %preheader ], [ %gep, %loop ] + %s = phi i8 [0, %preheader], [%snext, %loop] + %gep = getelementptr inbounds i8* %p.01.us.us, i64 1 + %snext = load i8* %gep + %cmp = icmp ult i8* %gep, %end + br i1 %cmp, label %loop, label %exit + +exit: + ret i8 %snext +} |

