[llvm] [SCCP] Remove masking operations (PR #142736)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 4 03:06:31 PDT 2025
================
@@ -232,6 +234,33 @@ static bool replaceSignedInst(SCCPSolver &Solver,
return true;
}
+/// Try to use \p Inst's value range from \p Solver to simplify it.
+static Value *simplifyInstruction(SCCPSolver &Solver,
+ SmallPtrSetImpl<Value *> &InsertedValues,
+ Instruction &Inst) {
+ auto GetRange = [&Solver, &InsertedValues](Value *Op) {
+ if (auto *Const = dyn_cast<Constant>(Op))
+ return Const->toConstantRange();
+ if (InsertedValues.contains(Op)) {
+ unsigned Bitwidth = Op->getType()->getScalarSizeInBits();
+ return ConstantRange::getFull(Bitwidth);
----------------
fhahn wrote:
Would be good to document that this is conservative handling for instructions inserted during simplification, i.e. no range info available.
https://github.com/llvm/llvm-project/pull/142736
More information about the llvm-commits
mailing list