[PATCH] D132417: [GlobalOpt] Bail out on SROA of a Global if a scalable vector type is seen

Cameron McInally via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 23 14:55:34 PDT 2022


cameron.mcinally updated this revision to Diff 454966.
cameron.mcinally added a comment.

> Not sure why you're sticking the test in llvm/test/CodeGen/AArch64 instead of llvm/test/Transforms/GlobalOpt/.

Good call, @efriedma. I was in SVE mode and not thinking. Patch updated.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D132417/new/

https://reviews.llvm.org/D132417

Files:
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/test/Transforms/GlobalOpt/2022-08-23-ScalableVectorCrash.ll


Index: llvm/test/Transforms/GlobalOpt/2022-08-23-ScalableVectorCrash.ll
===================================================================
--- /dev/null
+++ llvm/test/Transforms/GlobalOpt/2022-08-23-ScalableVectorCrash.ll
@@ -0,0 +1,15 @@
+; RUN: opt -globalopt < %s
+
+; Ensure we don't ICE by trying to optimize a scalable vector load of a global
+; variable.
+
+%struct.xxx = type <{ [96 x i8] }>
+
+ at .bss = internal unnamed_addr global %struct.xxx zeroinitializer, align 32
+
+define dso_local void @foo() local_unnamed_addr align 16 #0 {
+L.entry:
+  store <vscale x 2 x double> zeroinitializer, ptr @.bss, align 1
+  %0 = load <vscale x 2 x double>, ptr @.bss, align 8
+  unreachable
+}
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
===================================================================
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp
@@ -477,6 +477,10 @@
     if (Pair.first < Offset)
       return nullptr;
 
+    // Scalable types not currently supported.
+    if (isa<ScalableVectorType>(Pair.second))
+      return nullptr;
+
     Offset = Pair.first + DL.getTypeAllocSize(Pair.second);
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132417.454966.patch
Type: text/x-patch
Size: 1155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220823/8370f06f/attachment.bin>


More information about the llvm-commits mailing list