aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/ConstantFold.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2023-11-03 12:14:38 +0100
committerNikita Popov <npopov@redhat.com>2023-11-03 12:14:38 +0100
commitc1a9eabf56db21392587f76b4abaa30a01f3643a (patch)
treeb413be5299308fb7243dd89d358cd04e653c5f38 /llvm/lib/IR/ConstantFold.cpp
parent18cc980ca30e5f013542518439da020f45ebe497 (diff)
downloadllvm-c1a9eabf56db21392587f76b4abaa30a01f3643a.zip
llvm-c1a9eabf56db21392587f76b4abaa30a01f3643a.tar.gz
llvm-c1a9eabf56db21392587f76b4abaa30a01f3643a.tar.bz2
[ConstantFold] Don't mention irrelevant opcodes (NFCI)
This is folding an icmp, so fptrunc, fpext, uitofp, sitofp cannot appear here at all. Also drop the explicit checks for trunc, fptoui, fptosi, which can appear, but are just some random subset of opcodes that are not handled by this code.
Diffstat (limited to 'llvm/lib/IR/ConstantFold.cpp')
-rw-r--r--llvm/lib/IR/ConstantFold.cpp11
1 files changed, 1 insertions, 10 deletions
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 151bd0c..1d77857 100644
--- a/llvm/lib/IR/ConstantFold.cpp
+++ b/llvm/lib/IR/ConstantFold.cpp
@@ -1243,22 +1243,13 @@ static ICmpInst::Predicate evaluateICmpRelation(Constant *V1, Constant *V2,
Constant *CE1Op0 = CE1->getOperand(0);
switch (CE1->getOpcode()) {
- case Instruction::Trunc:
- case Instruction::FPTrunc:
- case Instruction::FPExt:
- case Instruction::FPToUI:
- case Instruction::FPToSI:
- break; // We can't evaluate floating point casts or truncations.
-
case Instruction::BitCast:
// If this is a global value cast, check to see if the RHS is also a
// GlobalValue.
if (const GlobalValue *GV = dyn_cast<GlobalValue>(CE1Op0))
if (const GlobalValue *GV2 = dyn_cast<GlobalValue>(V2))
return areGlobalsPotentiallyEqual(GV, GV2);
- [[fallthrough]];
- case Instruction::UIToFP:
- case Instruction::SIToFP:
+
// We can't evaluate floating point casts or truncations.
if (CE1Op0->getType()->isFPOrFPVectorTy())
break;