[clang] [CIR] Handle proper hoisting of const variables with InvariantGroupOp (PR #175037)

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 13 15:50:48 PST 2026


bcardosolopes wrote:

> Since h is external, LLVM cannot take the risk to eliminate the reload from alloca before calling use, despite that the reload is indeed unnecessary according to the C++ standard

For the testcase in hand, If cir.alloca was marked as const, wouldn't this allow a LoadOp folder to reuse any existing previous use (if available) instead? 

https://github.com/llvm/llvm-project/pull/175037


More information about the cfe-commits mailing list