Issue |
145875
|
Summary |
[SCEV] Repeated max not hoisted out of loop
|
Labels |
llvm:optimizations,
llvm:SCEV,
missed-optimization
|
Assignees |
|
Reporter |
aengelke
|
The repeated computation of a maximum/minimum is not hoisted outside of a loop, preventing the elimination of the loop (instead, the loop gets pointlessly vectorized).
Example (https://godbolt.org/z/faM4od4dM; see also: https://alive2.llvm.org/ce/z/YqPC82)
```c++
#include <cstdint>
uint8_t f(uint8_t n, uint8_t a, uint8_t b) {
for (uint8_t i = 0; i < n; i++)
a = a < b ? b : a;
return a;
}
```
To me this looks like something that SCEV should recognize (I might be wrong here, but in the end, the loop should get eliminated).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs