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

Qiongsi Wu via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 7 06:53:28 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.
----------------
qiongsiwu wrote:

Thanks Matt! Fixed. 

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


More information about the llvm-commits mailing list