aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/SourceMgr.cpp
diff options
context:
space:
mode:
authorFlorian Mayer <fmayer@google.com>2025-10-16 09:18:00 -0700
committerGitHub <noreply@github.com>2025-10-16 09:18:00 -0700
commit39b0cbe69ca8704dbc5846a91d136f0ed6101782 (patch)
tree7b18cd97e0f8f5bbc25360267188ee0e40503834 /llvm/lib/Support/SourceMgr.cpp
parent7fe069121b57a187e2072f01ecc84523948d9f04 (diff)
downloadllvm-39b0cbe69ca8704dbc5846a91d136f0ed6101782.zip
llvm-39b0cbe69ca8704dbc5846a91d136f0ed6101782.tar.gz
llvm-39b0cbe69ca8704dbc5846a91d136f0ed6101782.tar.bz2
[IndVarSimplify] Allow predicateLoopExit on some loops with thread-local writes (#155901)
This is important to optimize patterns that frequently appear with bounds checks: ``` for (int i = 0; i < N; ++i) { bar[i] = foo[i] + 123; } ``` which gets roughly turned into ``` for (int i = 0; i < N; ++i) { if (i >= size of foo) ubsan.trap(); if (i >= size of bar) ubsan.trap(); bar[i] = foo[i] + 123; } ``` Motivating example: https://github.com/google/boringssl/blob/main/crypto/fipsmodule/hmac/hmac.cc.inc#L138 I hand-verified the assembly and confirmed that this optimization removes the check in the loop. This also allowed the loop to be vectorized. Alive2: https://alive2.llvm.org/ce/z/3qMdLF I did a `stage2-check-all` for both normal and `-DBOOTSTRAP_CMAKE_C[XX]_FLAGS="-fsanitize=array-bounds -fsanitize-trap=all"`. I also ran some Google-internal tests with `fsanitize=array-bounds`. Everything passes.
Diffstat (limited to 'llvm/lib/Support/SourceMgr.cpp')
0 files changed, 0 insertions, 0 deletions