diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-17 23:01:49 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-17 23:01:49 +0000 |
commit | c8cb8ef9c2d5e354db661022d707a19b3533c00e (patch) | |
tree | ac1ea1d3cb2fa68360973a61ed2ce00728cb5f36 /test | |
parent | 0db841f9c2b9a25fb5ecb36e350d3a802c35654c (diff) | |
download | llvm-c8cb8ef9c2d5e354db661022d707a19b3533c00e.tar.gz llvm-c8cb8ef9c2d5e354db661022d707a19b3533c00e.tar.bz2 llvm-c8cb8ef9c2d5e354db661022d707a19b3533c00e.tar.xz |
have instcombine preserve nsw/nuw/exact when sinking
common operations through a phi.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125790 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Transforms/InstCombine/phi.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/phi.ll b/test/Transforms/InstCombine/phi.ll index e93666fbf8..62c6a63a7e 100644 --- a/test/Transforms/InstCombine/phi.ll +++ b/test/Transforms/InstCombine/phi.ll @@ -526,3 +526,21 @@ Exit: ; preds = %Loop ; CHECK-NEXT: ret i32 %B } +define i32 @test24(i32 %A, i1 %cond) { +BB0: + %X = add nuw nsw i32 %A, 1 + br i1 %cond, label %BB1, label %BB2 + +BB1: + %Y = add nuw i32 %A, 1 + br label %BB2 + +BB2: + %C = phi i32 [ %X, %BB0 ], [ %Y, %BB1 ] + ret i32 %C +; CHECK: @test24 +; CHECK-NOT: phi +; CHECK: BB2: +; CHECK-NEXT: %C = add nuw i32 %A, 1 +; CHECK-NEXT: ret i32 %C +} |