OSDN Git Service

[ConstantFold] Don't evaluate FP or FP vector casts or truncations when simplifying...
authorFangrui Song <maskray@google.com>
Fri, 12 Apr 2019 07:34:30 +0000 (07:34 +0000)
committerFangrui Song <maskray@google.com>
Fri, 12 Apr 2019 07:34:30 +0000 (07:34 +0000)
Fix PR41476

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358262 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/ConstantFold.cpp
test/Transforms/InstSimplify/bitcast-vector-fold.ll

index 3c01a48..1dfd528 100644 (file)
@@ -1574,7 +1574,7 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
     case Instruction::ZExt:
     case Instruction::SExt:
       // We can't evaluate floating point casts or truncations.
-      if (CE1Op0->getType()->isFloatingPointTy())
+      if (CE1Op0->getType()->isFPOrFPVectorTy())
         break;
 
       // If the cast is not actually changing bits, and the second operand is a
index c8c390e..608c956 100644 (file)
@@ -74,6 +74,14 @@ define <4 x i32> @test9(<1 x i64> %y) {
   ret <4 x i32> %c
 }
 
+define <1 x i1> @test10() {
+; CHECK-LABEL: @test10(
+; CHECK-NEXT:    ret <1 x i1> <i1 icmp eq (i64 bitcast (<1 x double> <double 0xFFFFFFFFFFFFFFFF> to i64), i64 0)>
+;
+  %ret = icmp eq <1 x i64> <i64 bitcast (<1 x double> <double 0xFFFFFFFFFFFFFFFF> to i64)>, zeroinitializer
+  ret <1 x i1> %ret
+}
+
 ; from MultiSource/Benchmarks/Bullet
 define <2 x float> @foo() {
 ; CHECK-LABEL: @foo(