[PATCH] D92392: [DAGCombine] Fix TypeSize warning in DAGCombine::visitLIFETIME_END
Joe Ellis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 1 07:23:51 PST 2020
joechrisellis created this revision.
joechrisellis added reviewers: peterwaller-arm, DavidTruby.
Herald added subscribers: llvm-commits, ecnelises, hiraditya.
Herald added a project: LLVM.
joechrisellis requested review of this revision.
Bail out early if we encounter a scalable store.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92392
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/AArch64/dag-combine-lifetime-end-store-typesize.ll
Index: llvm/test/CodeGen/AArch64/dag-combine-lifetime-end-store-typesize.ll
===================================================================
--- /dev/null
+++ llvm/test/CodeGen/AArch64/dag-combine-lifetime-end-store-typesize.ll
@@ -0,0 +1,21 @@
+; RUN: llc -mtriple=aarch64-- < %s 2>&1 | FileCheck --allow-empty %s
+
+; This regression test is defending against a TypeSize warning 'assumption that TypeSize is not
+; scalable'. This warning appeared in DAGCombiner::visitLIFETIME_END when visiting a LIFETIME_END
+; node linked to a scalable store.
+
+; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it.
+; CHECK-NOT: warning: {{.*}}TypeSize is not scalable
+
+declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture)
+declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture)
+
+define void @foo(<vscale x 4 x i32>* nocapture dereferenceable(16) %ptr) {
+entry:
+ %tmp = alloca <vscale x 4 x i32>, align 8
+ %tmp_ptr = bitcast <vscale x 4 x i32>* %tmp to i8*
+ call void @llvm.lifetime.start.p0i8(i64 32, i8* %tmp_ptr)
+ store <vscale x 4 x i32> undef, <vscale x 4 x i32>* %ptr
+ call void @llvm.lifetime.end.p0i8(i64 32, i8* %tmp_ptr)
+ ret void
+}
Index: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -17625,11 +17625,15 @@
// TODO: Can relax for unordered atomics (see D66309)
if (!ST->isSimple() || ST->isIndexed())
continue;
+ const TypeSize StoreSize = ST->getMemoryVT().getStoreSize();
+ // We cannot determine object bounds if the store is scalable; bail out.
+ if (StoreSize.isScalable())
+ continue;
const BaseIndexOffset StoreBase = BaseIndexOffset::match(ST, DAG);
// If we store purely within object bounds just before its lifetime ends,
// we can remove the store.
if (LifetimeEndBase.contains(DAG, LifetimeEnd->getSize() * 8, StoreBase,
- ST->getMemoryVT().getStoreSizeInBits())) {
+ StoreSize.getFixedSize() * 8)) {
LLVM_DEBUG(dbgs() << "\nRemoving store:"; StoreBase.dump();
dbgs() << "\nwithin LIFETIME_END of : ";
LifetimeEndBase.dump(); dbgs() << "\n");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92392.308651.patch
Type: text/x-patch
Size: 2395 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201201/e17f809a/attachment.bin>
More information about the llvm-commits
mailing list