Commit c0f2a88
committed
[RISCV] Guard against out of bound shifts in expandMul.
Spotted while reviewing #150211. If we're multiplying by -3 in i32
MulAmt contains 4,294,967,293 since we zero extend to uint64_t.
Adding 3 to this gives 0x100000000 which is a power of 2 and the log2
of that is 32, but we can't shift left by 32 in an i32.
We should use 0 instead of the shl in this case.
Normally we don't hit this case because decomeMulByConstant handles
it, but that's disabled by Qciac. And after #150211 the path in
expandMul will also be unreachable. So I didn't add a test to avoid
messing with that review.1 parent 05e08cd commit c0f2a88
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16184 | 16184 | | |
16185 | 16185 | | |
16186 | 16186 | | |
| 16187 | + | |
16187 | 16188 | | |
16188 | | - | |
| 16189 | + | |
| 16190 | + | |
| 16191 | + | |
| 16192 | + | |
| 16193 | + | |
16189 | 16194 | | |
16190 | | - | |
| 16195 | + | |
16191 | 16196 | | |
16192 | 16197 | | |
16193 | 16198 | | |
| |||
0 commit comments