diff options
author | Chris Lattner <sabre@nondot.org> | 2009-11-10 22:39:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-11-10 22:39:16 +0000 |
commit | 055d046f483af3c66f4d19a32a17fc63ed2c22d5 (patch) | |
tree | 9b163d1aaeb35eb400ee6440ed147558a9f06ce9 /test/Transforms/JumpThreading/basic.ll | |
parent | 40d8c28b27377199b7465ba2c5a2c59c6fd12fa9 (diff) | |
download | external_llvm-055d046f483af3c66f4d19a32a17fc63ed2c22d5.zip external_llvm-055d046f483af3c66f4d19a32a17fc63ed2c22d5.tar.gz external_llvm-055d046f483af3c66f4d19a32a17fc63ed2c22d5.tar.bz2 |
implement a TODO by teaching jump threading about "xor x, 1".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86739 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/JumpThreading/basic.ll')
-rw-r--r-- | test/Transforms/JumpThreading/basic.ll | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index ccb2a3f..c161a77 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -245,3 +245,42 @@ Y: ret i32 2 } + +;;; Verify that we can handle constraint propagation through "xor x, 1". +define i32 @test9(i1 %cond, i1 %cond2) { +Entry: +; CHECK: @test9 + %v1 = call i32 @f1() + br i1 %cond, label %Merge, label %F1 + +; CHECK: Entry: +; CHECK-NEXT: %v1 = call i32 @f1() +; CHECK-NEXT: br i1 %cond, label %F2, label %Merge + +F1: + %v2 = call i32 @f2() + br label %Merge + +Merge: + %B = phi i32 [%v1, %Entry], [%v2, %F1] + %M = icmp eq i32 %B, %v1 + %M1 = xor i1 %M, 1 + %N = icmp eq i32 %B, 47 + %O = and i1 %M1, %N + br i1 %O, label %T2, label %F2 + +; CHECK: Merge: +; CHECK-NOT: phi +; CHECK-NEXT: %v2 = call i32 @f2() + +T2: + %Q = zext i1 %M to i32 + ret i32 %Q + +F2: + ret i32 %B +; CHECK: F2: +; CHECK-NEXT: phi i32 +} + + |