aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@apple.com>2012-08-07 22:35:16 +0000
committerBob Wilson <bob.wilson@apple.com>2012-08-07 22:35:16 +0000
commitf12c95a8af22771845fa16253ad04e90741f5602 (patch)
tree104e6f1c380b0bb520c3b6f340ea55aa0d91a192 /test
parentb64dd5f2b5a9989a8b1006d0aa82428455da039a (diff)
downloadexternal_llvm-f12c95a8af22771845fa16253ad04e90741f5602.zip
external_llvm-f12c95a8af22771845fa16253ad04e90741f5602.tar.gz
external_llvm-f12c95a8af22771845fa16253ad04e90741f5602.tar.bz2
Fix a serious typo in InstCombine's optimization of comparisons.
An unsigned value converted to floating-point will always be greater than a negative constant. Unfortunately InstCombine reversed the check so that unsigned values were being optimized to always be greater than all positive floating-point constants. <rdar://problem/12029145> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161452 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/2008-11-08-FCmp.ll9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/2008-11-08-FCmp.ll b/test/Transforms/InstCombine/2008-11-08-FCmp.ll
index c636288..f33a1f5 100644
--- a/test/Transforms/InstCombine/2008-11-08-FCmp.ll
+++ b/test/Transforms/InstCombine/2008-11-08-FCmp.ll
@@ -45,3 +45,12 @@ define i1 @test6(i32 %val) {
ret i1 %2
; CHECK: ret i1 false
}
+
+; Check that optimizing unsigned >= comparisons correctly distinguishes
+; positive and negative constants. <rdar://problem/12029145>
+define i1 @test7(i32 %val) {
+ %1 = uitofp i32 %val to double
+ %2 = fcmp oge double %1, 3.200000e+00
+ ret i1 %2
+; CHECK: icmp ugt i32 %val, 3
+}