[PATCH] D83179: [SCCP] Use range metadata for loads and calls

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 6 14:31:10 PDT 2020


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

LGTM, thanks.

>   It should also be possible to use !nonnull

using ValueLattice::getNot/markNotConstant should possibly just work? For icmps we use ValueLattice's helpers, they should be able to deal with it, unless we bail out for pointers somewhere in SCCP.



================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:1107
 
+static ValueLatticeElement getValueFromMetadata(const Instruction *I) {
+  if (MDNode *Ranges = I->getMetadata(LLVMContext::MD_range))
----------------
I think we have something similar in LVI. Might be good to move the common logic to ValueLattice


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:1121
+  // as overdefined.
+  if (I.getType()->isStructTy() || I.isVolatile())
     return (void)markOverdefined(&I);
----------------
For volatile loads, I think we could still use the range info if present? We are just not allowed to remove the volatile operation, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83179





More information about the llvm-commits mailing list