[PATCH] D71938: [SCCP] Use constant ranges for casts.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 29 09:36:07 PDT 2020


fhahn added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:847
     markConstant(&I, C);
+    mergeInValue(&I, LatticeVal::get(C));
+  } else if (OpSt.isConstantRange() && I.getDestTy()->isIntegerTy()) {
----------------
efriedma wrote:
> This is calling both markConstant and mergeInValue?
This could just be markConstant as it was originally I think. Not sure if there are any scenarios where we would get constant after already having a (non-singleton) range.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:849
+  } else if (OpSt.isConstantRange() && I.getDestTy()->isIntegerTy()) {
+    LatticeVal &LV = getValueState(&I);
+    ConstantRange OpRange = OpSt.getConstantRange();
----------------
efriedma wrote:
> If I'm following correctly, both the source and destination must be integers, so this is one of bitcast/trunc/sext/zext?
Yep, otherwise we would mark the result of `  %tmp4 = sitofp i32 %r to double` as constant range, if %r is a constant range.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71938





More information about the llvm-commits mailing list