[PATCH] D149483: [SCEV] Use object size for globals to sharpen ranges.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 28 14:32:17 PDT 2023
fhahn marked 4 inline comments as done.
fhahn added inline comments.
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6794
+ // object.
+ APInt MaxVal = APInt::getMaxValue(ConservativeResult.getBitWidth()) -
+ APInt(ConservativeResult.getBitWidth(), ObjSize);
----------------
nikic wrote:
> Use the BitWidth variable?
Simplified, thanks!
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6798
+ uint64_t Rem = MaxVal.urem(Align);
+ MaxVal = MaxVal - APInt(ConservativeResult.getBitWidth(), Rem);
+ ConservativeResult = ConservativeResult.intersectWith(
----------------
nikic wrote:
> `-=`
updated, thanks!
================
Comment at: llvm/lib/Analysis/ScalarEvolution.cpp:6800
+ ConservativeResult = ConservativeResult.intersectWith(
+ {ConservativeResult.getUnsignedMin(), MaxVal + 1});
+ }
----------------
nikic wrote:
> `, RangeType`
Added, thanks!
================
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'
----------------
nikic wrote:
> Is there a particular reason we need to test the range of add of ptrtoint rather than the ptrtoint itself?
No particular reason, other than that was convenient to check with Alive2 and to make sure this leads to the expected results downstream of the range computations. But I can also update the tests to directly return the `ptrtoint` result.
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