diff options
author | Fangrui Song <maskray@google.com> | 2019-04-12 07:34:30 +0000 |
---|---|---|
committer | Fangrui Song <maskray@google.com> | 2019-04-12 07:34:30 +0000 |
commit | d5c404246f9f44440f16cafaca36d55763e82f34 (patch) | |
tree | e18ae0f79747e30639363f0149950fc676deb337 | |
parent | 85ce053d7e2614d65b3506b3a32748c8454f3810 (diff) | |
download | bcm5719-llvm-d5c404246f9f44440f16cafaca36d55763e82f34.tar.gz bcm5719-llvm-d5c404246f9f44440f16cafaca36d55763e82f34.zip |
[ConstantFold] Don't evaluate FP or FP vector casts or truncations when simplifying icmp
Fix PR41476
llvm-svn: 358262
-rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/InstSimplify/bitcast-vector-fold.ll | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 3c01a482a44..1dfd5284a97 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -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 diff --git a/llvm/test/Transforms/InstSimplify/bitcast-vector-fold.ll b/llvm/test/Transforms/InstSimplify/bitcast-vector-fold.ll index c8c390ea6be..608c95688f3 100644 --- a/llvm/test/Transforms/InstSimplify/bitcast-vector-fold.ll +++ b/llvm/test/Transforms/InstSimplify/bitcast-vector-fold.ll @@ -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( |