diff options
author | Andrew Scheidecker <andrew@scheidecker.net> | 2019-02-19 21:03:20 +0000 |
---|---|---|
committer | Andrew Scheidecker <andrew@scheidecker.net> | 2019-02-19 21:03:20 +0000 |
commit | bddf892a6d3afadaeeb3c9431c5e89a207739bdc (patch) | |
tree | 10147c962270f075339237d3451a0eb3f85c5d74 /llvm/lib/IR/ConstantFold.cpp | |
parent | a0b97254797873b69ad5087ef748aebcf4426db8 (diff) | |
download | bcm5719-llvm-bddf892a6d3afadaeeb3c9431c5e89a207739bdc.tar.gz bcm5719-llvm-bddf892a6d3afadaeeb3c9431c5e89a207739bdc.zip |
[ConstantFold] Fix misfolding of icmp with a bitcast FP second operand.
In the process of trying to eliminate the bitcast, this was producing a
malformed icmp with FP operands.
Differential revision: https://reviews.llvm.org/D51215
llvm-svn: 354380
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 748a2ce475f..2c958c7dd49 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -1980,11 +1980,13 @@ Constant *llvm::ConstantFoldCompareInstruction(unsigned short pred, // If the right hand side is a bitcast, try using its inverse to simplify // it by moving it to the left hand side. We can't do this if it would turn - // a vector compare into a scalar compare or visa versa. + // a vector compare into a scalar compare or visa versa, or if it would turn + // the operands into FP values. if (ConstantExpr *CE2 = dyn_cast<ConstantExpr>(C2)) { Constant *CE2Op0 = CE2->getOperand(0); if (CE2->getOpcode() == Instruction::BitCast && - CE2->getType()->isVectorTy() == CE2Op0->getType()->isVectorTy()) { + CE2->getType()->isVectorTy() == CE2Op0->getType()->isVectorTy() && + !CE2Op0->getType()->isFPOrFPVectorTy()) { Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); return ConstantExpr::getICmp(pred, Inverse, CE2Op0); } |