Commit 4d15af1
committed
[LLVM][LoopVectorize] Fix SIGFPE crash in getPredBlockCostDivisor
When computing block frequency division in getPredBlockCostDivisor,
the function could perform division by zero if BBFreq equals 0.
This caused a floating point exception crash when processing blocks
with zero block frequency information.
Add a guard check to return 1 when BBFreq is 0, avoiding the undefined
behavior while maintaining correct cost model behavior. A divisor of 1
indicates the block is executed at the same frequency as the header,
which is a safe default when frequency information is unavailable.
Fixes issue #1720491 parent f3c1645 commit 4d15af1
File tree
2 files changed
+43
-0
lines changed- llvm
- lib/Transforms/Vectorize
- test/Transforms/LoopVectorize
2 files changed
+43
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2907 | 2907 | | |
2908 | 2908 | | |
2909 | 2909 | | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
2910 | 2914 | | |
2911 | 2915 | | |
2912 | 2916 | | |
| |||
Lines changed: 39 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments