[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
Wed Aug 24 08:50:57 PDT 2022
cameron.mcinally updated this revision to Diff 455229.
cameron.mcinally added a comment.
Apologies, @efriedma. I've update the patch again to move the check into collectSRATypes(). Would you mind doing one more review?
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
@@ -375,6 +375,11 @@
auto It = Types.try_emplace(Offset.getZExtValue(), Ty).first;
if (Ty != It->second)
return false;
+
+ // Scalable types not currently supported.
+ if (isa<ScalableVectorType>(Ty))
+ return false;
+
continue;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132417.455229.patch
Type: text/x-patch
Size: 1176 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220824/18d100e2/attachment.bin>
More information about the llvm-commits
mailing list