diff options
author | Chris Lattner <sabre@nondot.org> | 2010-01-12 02:07:17 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-01-12 02:07:17 +0000 |
commit | 2249a0b1bd0941e61c0b87f2f64a5c8cab45f14c (patch) | |
tree | 6b58f509e04767cf04df9b6e1adbecf402537120 /test/Transforms/JumpThreading/basic.ll | |
parent | 68c3def12618f73ec237359cb07f8e9e68d50b3a (diff) | |
download | external_llvm-2249a0b1bd0941e61c0b87f2f64a5c8cab45f14c.zip external_llvm-2249a0b1bd0941e61c0b87f2f64a5c8cab45f14c.tar.gz external_llvm-2249a0b1bd0941e61c0b87f2f64a5c8cab45f14c.tar.bz2 |
Teach jump threading to duplicate small blocks when the branch
condition is a xor with a phi node. This eliminates nonsense
like this from 176.gcc in several places:
LBB166_84:
testl %eax, %eax
- setne %al
- xorb %cl, %al
- notb %al
- testb $1, %al
- je LBB166_85
+ je LBB166_69
+ jmp LBB166_85
This is rdar://7391699
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/JumpThreading/basic.ll')
-rw-r--r-- | test/Transforms/JumpThreading/basic.ll | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/test/Transforms/JumpThreading/basic.ll b/test/Transforms/JumpThreading/basic.ll index ac31cdb..34b4243 100644 --- a/test/Transforms/JumpThreading/basic.ll +++ b/test/Transforms/JumpThreading/basic.ll @@ -383,11 +383,11 @@ return: } -;;; Duplicate condition to avoid xor of cond. -;;; TODO: Make this happen. -define i32 @testXX(i1 %cond, i1 %cond2) { +;; Duplicate condition to avoid xor of cond. +;; rdar://7391699 +define i32 @test13(i1 %cond, i1 %cond2) { Entry: -; CHECK: @testXX +; CHECK: @test13 %v1 = call i32 @f1() br i1 %cond, label %Merge, label %F1 @@ -396,7 +396,8 @@ F1: Merge: %B = phi i1 [true, %Entry], [%cond2, %F1] - %M = icmp eq i32 %v1, 192 + %C = phi i32 [192, %Entry], [%v1, %F1] + %M = icmp eq i32 %C, 192 %N = xor i1 %B, %M br i1 %N, label %T2, label %F2 @@ -405,6 +406,18 @@ T2: F2: ret i32 %v1 + +;; FIXME: CONSTANT FOLD on clone and when phi gets eliminated. + +; CHECK: Entry.Merge_crit_edge: +; CHECK-NEXT: %M1 = icmp eq i32 192, 192 +; CHECK-NEXT: %N2 = xor i1 true, %M1 +; CHECK-NEXT: br i1 %N2, label %T2, label %F2 + +; CHECK: Merge: +; CHECK-NEXT: %M = icmp eq i32 %v1, 192 +; CHECK-NEXT: %N = xor i1 %cond2, %M +; CHECK-NEXT: br i1 %N, label %T2, label %F2 } |