diff options
author | Evan Cheng <evan.cheng@apple.com> | 2012-05-03 01:45:13 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2012-05-03 01:45:13 +0000 |
commit | d99d68bcee8ce91a18c397756c702363e030fd83 (patch) | |
tree | 1b61e12685ff3f767c998a31444d09201f8cc828 /test/CodeGen/X86/jump_sign.ll | |
parent | f12f6dff9784805e8f89309787231c1ec53a8c6e (diff) | |
download | external_llvm-d99d68bcee8ce91a18c397756c702363e030fd83.zip external_llvm-d99d68bcee8ce91a18c397756c702363e030fd83.tar.gz external_llvm-d99d68bcee8ce91a18c397756c702363e030fd83.tar.bz2 |
Fix two-address pass's aggressive instruction commuting heuristics. It's meant
to catch cases like:
%reg1024<def> = MOV r1
%reg1025<def> = MOV r0
%reg1026<def> = ADD %reg1024, %reg1025
r0 = MOV %reg1026
By commuting ADD, it let coalescer eliminate all of the copies. However, there
was a bug in the heuristics where it ended up commuting the ADD in:
%reg1024<def> = MOV r0
%reg1025<def> = MOV 0
%reg1026<def> = ADD %reg1024, %reg1025
r0 = MOV %reg1026
That did no benefit but rather ensure the last MOV would not be coalesced.
rdar://11355268
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156048 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/X86/jump_sign.ll')
-rw-r--r-- | test/CodeGen/X86/jump_sign.ll | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/CodeGen/X86/jump_sign.ll b/test/CodeGen/X86/jump_sign.ll index 35f69c9..94cbe5d 100644 --- a/test/CodeGen/X86/jump_sign.ll +++ b/test/CodeGen/X86/jump_sign.ll @@ -22,6 +22,7 @@ declare i32 @bar(...) declare i32 @baz(...) ; rdar://10633221 +; rdar://11355268 define i32 @g(i32 %a, i32 %b) nounwind { entry: ; CHECK: g: @@ -39,6 +40,8 @@ entry: ; CHECK: h: ; CHECK-NOT: cmp ; CHECK: cmov +; CHECK-NOT: movl +; CHECK: ret %cmp = icmp slt i32 %b, %a %sub = sub nsw i32 %a, %b %cond = select i1 %cmp, i32 %sub, i32 0 @@ -49,6 +52,8 @@ entry: ; CHECK: i: ; CHECK-NOT: cmp ; CHECK: cmov +; CHECK-NOT: movl +; CHECK: ret %cmp = icmp sgt i32 %a, %b %sub = sub nsw i32 %a, %b %cond = select i1 %cmp, i32 %sub, i32 0 @@ -59,6 +64,8 @@ entry: ; CHECK: j: ; CHECK-NOT: cmp ; CHECK: cmov +; CHECK-NOT: movl +; CHECK: ret %cmp = icmp ugt i32 %a, %b %sub = sub i32 %a, %b %cond = select i1 %cmp, i32 %sub, i32 0 @@ -69,6 +76,8 @@ entry: ; CHECK: k: ; CHECK-NOT: cmp ; CHECK: cmov +; CHECK-NOT: movl +; CHECK: ret %cmp = icmp ult i32 %b, %a %sub = sub i32 %a, %b %cond = select i1 %cmp, i32 %sub, i32 0 |