aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Interp.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2025-06-23 20:23:40 +0100
committerGitHub <noreply@github.com>2025-06-23 20:23:40 +0100
commit5d01697ec6cb5bf836faa35353d23ba6dd572042 (patch)
tree4cdcc5a4cf4e8197a6080d54242b1e3fe53cebdb /clang/lib/AST/ByteCode/Interp.cpp
parentbf4afb08fe1c3cbe77751dfd48f68acd9ca852be (diff)
downloadllvm-5d01697ec6cb5bf836faa35353d23ba6dd572042.zip
llvm-5d01697ec6cb5bf836faa35353d23ba6dd572042.tar.gz
llvm-5d01697ec6cb5bf836faa35353d23ba6dd572042.tar.bz2
[LAA] Be more careful when evaluating AddRecs at symbolic max BTC. (#128061)
Evaluating AR at the symbolic max BTC may wrap and create an expression that is less than the start of the AddRec due to wrapping (for example consider MaxBTC = -2). If that's the case, set ScEnd to -(EltSize + 1). ScEnd will get incremented by EltSize before returning, so this effectively sets ScEnd to unsigned max. Note that LAA separately checks that accesses cannot not wrap (52ded672492, https://github.com/llvm/llvm-project/pull/127543), so unsigned max represents an upper bound. When there is a computable backedge-taken count, we are guaranteed to execute the number of iterations, and if any pointer would wrap it would be UB (or the access will never be executed, so cannot alias). It includes new tests from the previous discussion that show a case we wrap with a BTC, but it is UB due to the pointer after the object wrapping (in `evaluate-at-backedge-taken-count-wrapping.ll`) When we have only a maximum backedge taken count, we instead try to use dereferenceability information to determine if the pointer access must be in bounds for the maximum backedge taken count. PR: https://github.com/llvm/llvm-project/pull/128061
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
0 files changed, 0 insertions, 0 deletions