[PATCH] D24854: [SROA] Expand lifetime.start/end offset checks to a couple more places.
Eli Friedman via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 22 17:54:23 PDT 2016
efriedma created this revision.
efriedma added a reviewer: chandlerc.
efriedma added subscribers: llvm-commits, Ka-Ka.
efriedma set the repository for this revision to rL LLVM.
Followup to r277969. For consistency, we need to check the offsets in a couple more places.
Fixes https://llvm.org/bugs/show_bug.cgi?id=29139.
Repository:
rL LLVM
https://reviews.llvm.org/D24854
Files:
lib/Transforms/Scalar/SROA.cpp
test/Transforms/SROA/basictest.ll
Index: test/Transforms/SROA/basictest.ll
===================================================================
--- test/Transforms/SROA/basictest.ll
+++ test/Transforms/SROA/basictest.ll
@@ -1684,3 +1684,15 @@
call void @llvm.lifetime.end(i64 8, i8* %3)
ret void
}
+
+define void @PR29139() {
+; CHECK-LABEL: @PR29139(
+; CHECK: alloca i32
+; CHECK: call void @llvm.lifetime.end(i64 2
+bb1:
+ %e.7.sroa.6.i = alloca i32, align 1
+ %e.7.sroa.6.0.load81.i = load i32, i32* %e.7.sroa.6.i, align 1
+ %0 = bitcast i32* %e.7.sroa.6.i to i8*
+ call void @llvm.lifetime.end(i64 2, i8* %0)
+ unreachable
+}
Index: lib/Transforms/Scalar/SROA.cpp
===================================================================
--- lib/Transforms/Scalar/SROA.cpp
+++ lib/Transforms/Scalar/SROA.cpp
@@ -1738,6 +1738,8 @@
if (II->getIntrinsicID() != Intrinsic::lifetime_start &&
II->getIntrinsicID() != Intrinsic::lifetime_end)
return false;
+ if (S.beginOffset() != P.beginOffset() || S.endOffset() != P.endOffset())
+ return false;
} else if (U->get()->getType()->getPointerElementType()->isStructTy()) {
// Disable vector promotion when there are loads or stores of an FCA.
return false;
@@ -1950,6 +1952,8 @@
if (II->getIntrinsicID() != Intrinsic::lifetime_start &&
II->getIntrinsicID() != Intrinsic::lifetime_end)
return false;
+ if (RelBegin != 0 || RelEnd != Size)
+ return false;
} else {
return false;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24854.72229.patch
Type: text/x-patch
Size: 1479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160923/ab8e6c6a/attachment.bin>
More information about the llvm-commits
mailing list