[llvm] [CodeGen] Handling Oversized Alloca Types under 32 bit Mode to Avoid Code Generator Crash (PR #71472)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 6 21:07:44 PST 2023


================
@@ -0,0 +1,46 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
+; The instcombine pass can turn
+;     alloca i32, i32 -1
+; to
+;     alloca [4294967295 x i32], i32 1
+; because it zero extends the NumElements to unit64_t.
+; The zero extension can lead to oversized arrays on a 32 bit system.
+; Alloca-ing an array of size bigger than half of the address space
+; is most likely an undefined behaviour, but the code generator
+; should not crash in such situations.
----------------
arsenm wrote:

The description is imprecise. Don't mention instcombine, it's not relevant. This is about supporting allocations exceeding the address space size, regardless of what happens during IR canonicalization. It's not undefined from an IR perspective, but it's also can't be meaningfully codegened 

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


More information about the llvm-commits mailing list