[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


================
@@ -4138,9 +4138,10 @@ void SelectionDAGBuilder::visitAlloca(const AllocaInst &I) {
                                           APInt(IntPtr.getScalarSizeInBits(),
                                                 TySize.getKnownMinValue())));
   else
-    AllocSize =
-        DAG.getNode(ISD::MUL, dl, IntPtr, AllocSize,
-                    DAG.getConstant(TySize.getFixedValue(), dl, IntPtr));
+    AllocSize = DAG.getNode(ISD::MUL, dl, IntPtr, AllocSize,
+                            DAG.getConstant(APInt(IntPtr.getScalarSizeInBits(),
----------------
arsenm wrote:

Rather than constructing your own APInt, I think it would be clearer to use DAG.getZExtOrTrunc to the IntPtr type 

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


More information about the llvm-commits mailing list