diff options
author | goldsteinn <35538541+goldsteinn@users.noreply.github.com> | 2024-10-31 07:14:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-31 09:14:33 -0500 |
commit | 1e072ae289d77c3c9704a9ae832c076a303c435b (patch) | |
tree | 96d774b6e3dec3845a9f5e5b2fcdc94a100b1a1e /lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h | |
parent | 0ab44fd2464354dfdca0e7afacbb21a84bca46d9 (diff) | |
download | llvm-1e072ae289d77c3c9704a9ae832c076a303c435b.zip llvm-1e072ae289d77c3c9704a9ae832c076a303c435b.tar.gz llvm-1e072ae289d77c3c9704a9ae832c076a303c435b.tar.bz2 |
[CGP] [CodeGenPrepare] Folding `urem` with loop invariant value plus offset (#104724)
This extends the existing fold:
```
for(i = Start; i < End; ++i)
Rem = (i nuw+- IncrLoopInvariant) u% RemAmtLoopInvariant;
```
->
```
Rem = (Start nuw+- IncrLoopInvariant) % RemAmtLoopInvariant;
for(i = Start; i < End; ++i, ++rem)
Rem = rem == RemAmtLoopInvariant ? 0 : Rem;
```
To work with a non-zero `IncrLoopInvariant`.
This is a common usage in cases such as:
```
for(i = 0; i < N; ++i)
if ((i + 1) % X) == 0)
do_something_occasionally_but_not_first_iter();
```
Alive2 w/ i4/unrolled 6x (needs to be ran locally due to timeout):
https://alive2.llvm.org/ce/z/6tgyN3
Exhaust proof over all uint8_t combinations in C++:
https://godbolt.org/z/WYa561388
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python/SWIGPythonBridge.h')
0 files changed, 0 insertions, 0 deletions