diff options
author | Craig Topper <craig.topper@sifive.com> | 2025-07-24 17:27:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-24 17:27:48 -0700 |
commit | ae367028073f263c1b17faec70889fde36435c6d (patch) | |
tree | 40a5ff8f763e5db1d21995d299f1928ac91641b2 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 9f724d04275df1f6bfd1e4346a9c69748d04ee7f (diff) | |
download | llvm-ae367028073f263c1b17faec70889fde36435c6d.zip llvm-ae367028073f263c1b17faec70889fde36435c6d.tar.gz llvm-ae367028073f263c1b17faec70889fde36435c6d.tar.bz2 |
[RISCV] Guard against out of bound shifts in expandMul. (#150464)
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.
Detect this case and skip the transform. We could use 0, but we don't
handle the case for i64 so this seemed more consistent.
Normally we don't hit this case because decomposeMulByConstant handles
it, but that's disabled by Xqciac. And after #150211 the code in
expandMul is now unreachable for this case.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions