[PATCH] D112721: [SCCP] Tune cast instruction handling for overdefined operand

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 8 06:40:06 PST 2021


fhahn accepted this revision.
fhahn added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!



================
Comment at: llvm/lib/Transforms/Utils/SCCPSolver.cpp:818
     markConstant(&I, C);
-  } else if (OpSt.isConstantRange() && I.getDestTy()->isIntegerTy()) {
+  } else if ((OpSt.isConstantRange() || OpSt.isOverdefined()) &&
+             I.getDestTy()->isIntegerTy()) {
----------------
anton-afanasyev wrote:
> fhahn wrote:
> > IIUC we need to check for range or overdefined here explicitly because we implicitly do not do anything for under or overdefined.
> > 
> > Could we instead add an early bail out on undeforunknown, only check for integer types here (and not constant range and overdefined) and drop the markOverdefined in the else of below?
> Sure, thanks, dit it that way. Potentially this could be not NFC and improve handling of NotConstant operand, but SCCP doesn't use NotConstant state, so actually no change at all.
> Sure, thanks, dit it that way. Potentially this could be not NFC and improve handling of NotConstant operand, but SCCP doesn't use NotConstant state, so actually no change at all.

Yeah, NotConstant should not be used for integers at the very least, might be worth adding an assert here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D112721



More information about the llvm-commits mailing list