summaryrefslogtreecommitdiff
path: root/test/CodeGen
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-01-18 21:38:44 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-01-18 21:38:44 +0000
commit1ad0e8b5769f25ca442f3d77bf374d03469010bc (patch)
treea4413ab41fe7bc56f036ec89728f80bde599b205 /test/CodeGen
parent2d53c21eca34b77bbe12a5208af9da780d6465c8 (diff)
downloadllvm-1ad0e8b5769f25ca442f3d77bf374d03469010bc.tar.gz
llvm-1ad0e8b5769f25ca442f3d77bf374d03469010bc.tar.bz2
llvm-1ad0e8b5769f25ca442f3d77bf374d03469010bc.tar.xz
Canonicalize -1 - x to ~x.
Instcombine does this but apparently there are situations where this pattern will escape the optimizer and / or created by isel. Here is a case that's seen in JavaScriptCore: %t1 = sub i32 0, %a %t2 = add i32 %t1, -1 The dag combiner pattern: ((c1-A)+c2) -> (c1+c2)-A will fold it to -1 - %a. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen')
-rw-r--r--test/CodeGen/X86/xor.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/CodeGen/X86/xor.ll b/test/CodeGen/X86/xor.ll
index 7bd06bba4c..9bfff8a06a 100644
--- a/test/CodeGen/X86/xor.ll
+++ b/test/CodeGen/X86/xor.ll
@@ -131,3 +131,14 @@ bb12:
; X32: andl {{.*}}[[REG]]
}
+define i32 @test8(i32 %a) nounwind {
+; rdar://7553032
+entry:
+ %t1 = sub i32 0, %a
+ %t2 = add i32 %t1, -1
+ ret i32 %t2
+; X64: test8:
+; X64: notl %eax
+; X32: test8:
+; X32: notl %eax
+}