[llvm-branch-commits] [llvm] c1a9eab - [ConstantFold] Don't mention irrelevant opcodes (NFCI)
Nikita Popov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Nov 3 13:41:07 PDT 2023
Author: Nikita Popov
Date: 2023-11-03T12:14:38+01:00
New Revision: c1a9eabf56db21392587f76b4abaa30a01f3643a
URL: https://github.com/llvm/llvm-project/commit/c1a9eabf56db21392587f76b4abaa30a01f3643a
DIFF: https://github.com/llvm/llvm-project/commit/c1a9eabf56db21392587f76b4abaa30a01f3643a.diff
LOG: [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.
Added:
Modified:
llvm/lib/IR/ConstantFold.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/ConstantFold.cpp b/llvm/lib/IR/ConstantFold.cpp
index 151bd0c7086aa68..1d7785760214f77 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;
More information about the llvm-branch-commits
mailing list