[PATCH] D153717: [SCCP] Replace valuestate.isConstant with helper isConstant

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 7 00:54:54 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:1223
   ValueLatticeElement OpSt = getValueState(I.getOperand(0));
-  if (OpSt.isUnknownOrUndef())
+  if (OpSt.isUnknownOrUndefOrPoison())
     return;
----------------
StephenFan wrote:
> nikic wrote:
> > Shouldn't we propagate poison here and in similar cases (by going through the Constant path)?
> Yes. But currently `SCCPSolver::getConstant(ValueLatticeElement)` doesn't support get undef or poison constant values. And undef or poison are represented in SCCPSolver just by the enum tags which don't have the type information to construct UndefValue or PoisonValue. To support this, we should record the undef or poison in ConstVal instead of just representing it by tags.
Since recently getConstant() also takes the type, so you can materialize a PoisonValue with the correct type there.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D153717/new/

https://reviews.llvm.org/D153717



More information about the llvm-commits mailing list