diff options
author | Dan Gohman <gohman@apple.com> | 2009-04-22 16:11:16 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-04-22 16:11:16 +0000 |
commit | aabb04f52714ceb271dba7da18f757a4365bb4ac (patch) | |
tree | 87f55a4ac2b1d42a6f432ee1896facefc65af46f /test/Transforms/IndVarSimplify/casted-argument.ll | |
parent | 6cdc727f2d7f68734526ef078f4632798ad40791 (diff) | |
download | external_llvm-aabb04f52714ceb271dba7da18f757a4365bb4ac.zip external_llvm-aabb04f52714ceb271dba7da18f757a4365bb4ac.tar.gz external_llvm-aabb04f52714ceb271dba7da18f757a4365bb4ac.tar.bz2 |
SCEVExpander's InsertCastOfTo knows how to move existing cast
instructions in order to avoid inserting new ones. However, if
the cast instruction is the SCEVExpander's InsertPt, this
causes subsequently emitted instructions to be inserted near
the cast, and not at the location of the original insert point.
Fix this by adjusting the insert point in such cases.
This fixes PR4009.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69808 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/IndVarSimplify/casted-argument.ll')
-rw-r--r-- | test/Transforms/IndVarSimplify/casted-argument.ll | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Transforms/IndVarSimplify/casted-argument.ll b/test/Transforms/IndVarSimplify/casted-argument.ll new file mode 100644 index 0000000..ae41e3a --- /dev/null +++ b/test/Transforms/IndVarSimplify/casted-argument.ll @@ -0,0 +1,24 @@ +; RUN: llvm-as < %s | opt -indvars -disable-output +; PR4009 + +target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32" +target triple = "i386-pc-linux-gnu" + +define void @safe_bcopy(i8* %to) nounwind { +entry: + %cmp11 = icmp ult i8* %to, null ; <i1> [#uses=1] + br i1 %cmp11, label %loop, label %return + +return: ; preds = %entry + ret void + +loop: ; preds = %loop, %if.else + %pn = phi i8* [ %ge, %loop ], [ null, %entry ] ; <i8*> [#uses=1] + %cp = ptrtoint i8* %to to i32 ; <i32> [#uses=1] + %su = sub i32 0, %cp ; <i32> [#uses=1] + %ge = getelementptr i8* %pn, i32 %su ; <i8*> [#uses=2] + tail call void @bcopy(i8* %ge) nounwind + br label %loop +} + +declare void @bcopy(i8* nocapture) nounwind |