diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-06-25 19:51:39 +0800 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2024-08-18 15:58:24 -0700 |
commit | c64ce8bf283120fd145a57d0e61f9697f719139d (patch) | |
tree | 40168c956007111e0dea5d78f045323da3f95881 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | f16125a13ce725b1e936468e08257c0fbb80c0fa (diff) | |
download | llvm-c64ce8bf283120fd145a57d0e61f9697f719139d.zip llvm-c64ce8bf283120fd145a57d0e61f9697f719139d.tar.gz llvm-c64ce8bf283120fd145a57d0e61f9697f719139d.tar.bz2 |
[CodeGenPrepare] Folding `urem` with loop invariant value
```
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;
```
In its current state, only if `IncrLoopInvariant` and `Start` both
being zero.
Alive2 seemed unable to prove this (see:
https://alive2.llvm.org/ce/z/ATGDp3 which is clearly wrong but still
checks out...) so wrote an exhaustive test here:
https://godbolt.org/z/WYa561388
Closes #96625
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions