diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-24 22:46:11 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2011-02-24 22:46:11 +0000 |
| commit | 27361a712423283d5c1c330741ac5c93b74f9b1c (patch) | |
| tree | 329f4455be9baec9bb0efc8cb98337885b1109d1 /llvm/test/Transforms/SimplifyCFG | |
| parent | 71337622329b5046a7a8f902a91f07cc4b0776fc (diff) | |
| download | bcm5719-llvm-27361a712423283d5c1c330741ac5c93b74f9b1c.tar.gz bcm5719-llvm-27361a712423283d5c1c330741ac5c93b74f9b1c.zip | |
SimplifyCFG: GEPs with constant indices are cheap enough to be executed unconditionally.
llvm-svn: 126445
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG')
| -rw-r--r-- | llvm/test/Transforms/SimplifyCFG/select-gep.ll | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/select-gep.ll b/llvm/test/Transforms/SimplifyCFG/select-gep.ll new file mode 100644 index 00000000000..6330ccdb291 --- /dev/null +++ b/llvm/test/Transforms/SimplifyCFG/select-gep.ll @@ -0,0 +1,20 @@ +; RUN: opt -S -simplifycfg %s | FileCheck %s + +define i8* @test1(i8* %x) nounwind { +entry: + %tmp1 = load i8* %x, align 1 + %cmp = icmp eq i8 %tmp1, 47 + br i1 %cmp, label %if.then, label %if.end + +if.then: + %incdec.ptr = getelementptr inbounds i8* %x, i64 1 + br label %if.end + +if.end: + %x.addr = phi i8* [ %incdec.ptr, %if.then ], [ %x, %entry ] + ret i8* %x.addr + +; CHECK: @test1 +; CHECK: %x.addr = select i1 %cmp, i8* %incdec.ptr, i8* %x +; CHECK: ret i8* %x.addr +} |

