commit | ae367028073f263c1b17faec70889fde36435c6d | [log] [tgz] |
---|---|---|
author | Craig Topper <craig.topper@sifive.com> | Thu Jul 24 17:27:48 2025 -0700 |
committer | GitHub <noreply@github.com> | Thu Jul 24 17:27:48 2025 -0700 |
tree | 40a5ff8f763e5db1d21995d299f1928ac91641b2 | |
parent | 9f724d04275df1f6bfd1e4346a9c69748d04ee7f [diff] |
[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.
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.