[PATCH] D149483: [SCEV] Use object size for globals to sharpen ranges.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 14:23:05 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6794
+        // object.
+        APInt MaxVal = APInt::getMaxValue(ConservativeResult.getBitWidth()) -
+                       APInt(ConservativeResult.getBitWidth(), ObjSize);
----------------
Use the BitWidth variable?


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6798
+        uint64_t Rem = MaxVal.urem(Align);
+        MaxVal = MaxVal - APInt(ConservativeResult.getBitWidth(), Rem);
+        ConservativeResult = ConservativeResult.intersectWith(
----------------
`-=`


================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6800
+        ConservativeResult = ConservativeResult.intersectWith(
+            {ConservativeResult.getUnsignedMin(), MaxVal + 1});
+      }
----------------
`, RangeType`


================
Comment at: llvm/test/Analysis/ScalarEvolution/ptrtoint-global.ll:9
 
 define i64 @ptrtoint_align_2_size_4_add_5() {
 ; CHECK-LABEL: 'ptrtoint_align_2_size_4_add_5'
----------------
Is there a particular reason we need to test the range of add of ptrtoint rather than the ptrtoint itself?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149483



More information about the llvm-commits mailing list