[llvm] [InstCombine] Avoid Allocating Arrays Too Large For the Target (PR #70980)

Qiongsi Wu via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 07:31:48 PDT 2023


qiongsiwu wrote:

> I don't think this is really a solution to codegen dying on oversized arrays. The underlying issue still exists regardless of whether InstCombine cleans up constant sized array allocations.
> 
> I think a better fix would be to adjust codegen to treat oversized allocations like dynamic stack allocations

Thanks for chiming in Matt @arsenm !! I agree that this may not fix all the cases that the codegen does not like an oversized constant. That said, it also seems incorrect that we turn `alloca i32, i32 -1` into `alloca [4294967295 x i32], i32 1` (due to zero extending `i32 -1` to `uint64_t`). An earlier fix I tried was to avoid this optimization when the alloca NumElements is negative. But that failed the existing test case. Do you think we should in fact do nothing when the alloca NumElements value is negative? 

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


More information about the llvm-commits mailing list