[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
Mon Aug 22 15:13:27 PDT 2022


cameron.mcinally created this revision.
cameron.mcinally added reviewers: paulwalker-arm, david-arm, sdesmalen, efriedma, craig.topper.
Herald added subscribers: ormris, StephenFan, hiraditya.
Herald added a project: All.
cameron.mcinally requested review of this revision.
Herald added subscribers: llvm-commits, alextsao1999.
Herald added a project: LLVM.

This is more a bug report than an earnest patch. The GlobalOpt pass is ICE'ing on scalable vector types. I've included a little patch to bail out if a scalable type is seen, but I'm not sure if that's still the current best practice for handling passes that haven't been updated for scalable vector types.

If this patch is acceptable, I'll be happy to commit the change...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132417

Files:
  llvm/lib/Transforms/IPO/GlobalOpt.cpp
  llvm/test/CodeGen/AArch64/sve-scalable-globalopt-assert.ll


Index: llvm/test/CodeGen/AArch64/sve-scalable-globalopt-assert.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/sve-scalable-globalopt-assert.ll
@@ -0,0 +1,19 @@
+; RUN: opt -globalopt < %s
+
+target triple = "aarch64-unknown-linux-gnu"
+
+; 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
+}
+
+attributes #0 = { "target-features"="+sve" }
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.454626.patch
Type: text/x-patch
Size: 1238 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220822/82ebfade/attachment.bin>


More information about the llvm-commits mailing list