diff options
author | Nikita Popov <npopov@redhat.com> | 2023-11-03 14:30:16 +0100 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-11-03 14:30:16 +0100 |
commit | e299a4287018769b9dfdd1eea8609bb59423ae90 (patch) | |
tree | 7e55d9c497a793ea1c392daf037f79063ef87d04 /llvm/lib/IR/ConstantFold.cpp | |
parent | 9915ebaa5e596358b9b8b6753723b613b780b09c (diff) | |
download | llvm-e299a4287018769b9dfdd1eea8609bb59423ae90.zip llvm-e299a4287018769b9dfdd1eea8609bb59423ae90.tar.gz llvm-e299a4287018769b9dfdd1eea8609bb59423ae90.tar.bz2 |
[ConstantFold] Remove redundant bitcast icmp handling (NFCI)
This code excludes vector/scalar and FP bitcasts. All other
integer/pointer bitcasts are no-op bitcasts and will be removed
entirely.
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r-- | llvm/lib/IR/ConstantFold.cpp | 14 |
1 files changed, 0 insertions, 14 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp index 3028668..f877fb6 100644 --- a/llvm/lib/IR/ConstantFold.cpp +++ b/llvm/lib/IR/ConstantFold.cpp @@ -1451,20 +1451,6 @@ Constant *llvm::ConstantFoldCompareInstruction(CmpInst::Predicate Predicate, if (Result != -1) return ConstantInt::get(ResultTy, Result); - // 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, 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() && - !CE2Op0->getType()->isFPOrFPVectorTy()) { - Constant *Inverse = ConstantExpr::getBitCast(C1, CE2Op0->getType()); - return ConstantExpr::getICmp(Predicate, Inverse, CE2Op0); - } - } - if ((!isa<ConstantExpr>(C1) && isa<ConstantExpr>(C2)) || (C1->isNullValue() && !C2->isNullValue())) { // If C2 is a constant expr and C1 isn't, flip them around and fold the |