[llvm] r374859 - Revert [SROA] Reuse existing lifetime markers if possible
David L. Jones via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 21:32:07 PDT 2019
Author: dlj
Date: Mon Oct 14 21:32:07 2019
New Revision: 374859
URL: http://llvm.org/viewvc/llvm-project?rev=374859&view=rev
Log:
Revert [SROA] Reuse existing lifetime markers if possible
This reverts r374692 (git commit 92694eba933ef4ea0b1b6377809ff266df37d61b)
Reproducer sent to commit thread on llvm-commits.
Removed:
llvm/trunk/test/Transforms/SROA/reuse_lifetime_markers.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/SROA.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=374859&r1=374858&r2=374859&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Mon Oct 14 21:32:07 2019
@@ -3072,13 +3072,6 @@ private:
LLVM_DEBUG(dbgs() << " original: " << II << "\n");
assert(II.getArgOperand(1) == OldPtr);
- bool EntireRange = (NewBeginOffset == NewAllocaBeginOffset &&
- NewEndOffset == NewAllocaEndOffset);
-
- // If the new lifetime marker would not differ from the old, just keep it.
- if (&OldAI == &NewAI && EntireRange)
- return true;
-
// Record this instruction for deletion.
Pass.DeadInsts.insert(&II);
@@ -3089,7 +3082,8 @@ private:
// promoted, but PromoteMemToReg doesn't handle that case.)
// FIXME: Check whether the alloca is promotable before dropping the
// lifetime intrinsics?
- if (!EntireRange)
+ if (NewBeginOffset != NewAllocaBeginOffset ||
+ NewEndOffset != NewAllocaEndOffset)
return true;
ConstantInt *Size =
Removed: llvm/trunk/test/Transforms/SROA/reuse_lifetime_markers.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SROA/reuse_lifetime_markers.ll?rev=374858&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SROA/reuse_lifetime_markers.ll (original)
+++ llvm/trunk/test/Transforms/SROA/reuse_lifetime_markers.ll (removed)
@@ -1,69 +0,0 @@
-; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt < %s -sroa -S | FileCheck %s
-;
-; Make sure we reuse the lifetime marker and do not create a new one that looks the same but without the call site attributes.
-target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
-
-; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture) #0
-
-; Function Attrs: argmemonly nounwind willreturn
-declare void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nocapture writeonly, i8* noalias nocapture readonly, i64, i1 immarg) #0
-
-define hidden void @old_markers() {
-;
-; CHECK-LABEL: define {{[^@]+}}@old_markers(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: [[VV_SROA_4:%.*]] = alloca [3 x i32*]
-; CHECK-NEXT: [[VV_SROA_4_0__SROA_CAST61:%.*]] = bitcast [3 x i32*]* [[VV_SROA_4]] to i8*
-; CHECK-NEXT: [[VV_SROA_4_0__SROA_CAST94:%.*]] = bitcast [3 x i32*]* [[VV_SROA_4]] to i8*
-; CHECK-NEXT: call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull align 8 dereferenceable(24) [[VV_SROA_4_0__SROA_CAST94]])
-; CHECK-NEXT: br i1 undef, label [[DO_BODY:%.*]], label [[IF_END31:%.*]]
-; CHECK: do.body:
-; CHECK-NEXT: ret void
-; CHECK: if.end31:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nonnull align 8 dereferenceable(24) [[VV_SROA_4_0__SROA_CAST61]], i8* noalias nonnull align 8 undef, i64 24, i1 false)
-; CHECK-NEXT: unreachable
-;
-entry:
- %vv.sroa.4 = alloca [3 x i32*]
- %vv.sroa.4.0..sroa_cast61 = bitcast [3 x i32*]* %vv.sroa.4 to i8*
- %vv.sroa.4.0..sroa_cast94 = bitcast [3 x i32*]* %vv.sroa.4 to i8*
- call void @llvm.lifetime.start.p0i8(i64 24, i8* nonnull align 8 dereferenceable(24) %vv.sroa.4.0..sroa_cast94)
- br i1 undef, label %do.body, label %if.end31
-
-do.body: ; preds = %entry
- ret void
-
-if.end31: ; preds = %entry
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nonnull align 8 dereferenceable(24) %vv.sroa.4.0..sroa_cast61, i8* noalias nonnull align 8 undef, i64 24, i1 false)
- unreachable
-}
-
-define hidden void @new_markers() {
-;
-; CHECK-LABEL: define {{[^@]+}}@new_markers(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: [[VV_SROA_4:%.*]] = alloca [3 x i32*]
-; CHECK-NEXT: [[VV_SROA_4_0__SROA_CAST61:%.*]] = bitcast [3 x i32*]* [[VV_SROA_4]] to i8*
-; CHECK-NEXT: br i1 undef, label [[DO_BODY:%.*]], label [[IF_END31:%.*]]
-; CHECK: do.body:
-; CHECK-NEXT: ret void
-; CHECK: if.end31:
-; CHECK-NEXT: call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nonnull align 8 dereferenceable(24) [[VV_SROA_4_0__SROA_CAST61]], i8* noalias nonnull align 8 undef, i64 24, i1 false)
-; CHECK-NEXT: unreachable
-;
-entry:
- %vv.sroa.4 = alloca [3 x i32*]
- %vv.sroa.4.0..sroa_cast61 = bitcast [3 x i32*]* %vv.sroa.4 to i8*
- %vv.sroa.4.0..sroa_cast94 = bitcast [3 x i32*]* %vv.sroa.4 to i8*
- call void @llvm.lifetime.start.p0i8(i64 8, i8* nonnull align 8 dereferenceable(24) %vv.sroa.4.0..sroa_cast94)
- br i1 undef, label %do.body, label %if.end31
-
-do.body: ; preds = %entry
- ret void
-
-if.end31: ; preds = %entry
- call void @llvm.memcpy.p0i8.p0i8.i64(i8* noalias nonnull align 8 dereferenceable(24) %vv.sroa.4.0..sroa_cast61, i8* noalias nonnull align 8 undef, i64 24, i1 false)
- unreachable
-}
More information about the llvm-commits
mailing list