[PATCH] D112611: [BasicAA] Handle known bits as ranges
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 27 03:59:44 PDT 2021
nikic created this revision.
nikic added reviewers: reames, courbet, fhahn, jdoerfert.
Herald added subscribers: jeroen.dobbelaere, arphaman, hiraditya.
nikic requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
BasicAA currently tries to determine that the offset is positive by checking whether all variable indices are positive based on known bits, multiplied by a positive scale. However, this is incorrect if the scale multiplication might overflow. In the modified test case the original value is positive, but may be negative after a left shift.
Fix this by converting known bits into a constant range and reusing the range-based logic, which handles overflow correctly.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D112611
Files:
llvm/lib/Analysis/BasicAliasAnalysis.cpp
llvm/test/Analysis/BasicAA/assume-index-positive.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112611.382597.patch
Type: text/x-patch
Size: 4856 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211027/fb500bd7/attachment.bin>
More information about the llvm-commits
mailing list