[llvm] r277969 - [SROA] Fix crash with lifetime intrinsic partially covering alloca.
Yung, Douglas via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 02:02:10 PDT 2016
Hi Eli,
I suspect the change you made here is causing the assertion failure in PR29139 (https://llvm.org/bugs/show_bug.cgi?id=29139). Could you please take a look?
Douglas Yung
> -----Original Message-----
> From: llvm-commits [mailto:llvm-commits-bounces at lists.llvm.org] On
> Behalf Of Eli Friedman via llvm-commits
> Sent: Sunday, August 07, 2016 18:31
> To: llvm-commits at lists.llvm.org
> Subject: [llvm] r277969 - [SROA] Fix crash with lifetime intrinsic
> partially covering alloca.
>
> Author: efriedma
> Date: Sun Aug 7 20:30:53 2016
> New Revision: 277969
>
> URL: http://llvm.org/viewvc/llvm-project?rev=277969&view=rev
> Log:
> [SROA] Fix crash with lifetime intrinsic partially covering alloca.
>
> Summary:
> PromoteMemToReg looks specifically for the pattern
> bitcast+lifetime.start (or a bitcast-equivalent GEP); any offset
> will lead to an assertion failure.
>
> Fixes https://llvm.org/bugs/show_bug.cgi?id=27999 .
>
> Differential Revision: https://reviews.llvm.org/D22737
>
> Modified:
> llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> llvm/trunk/test/Transforms/SROA/basictest.ll
>
> Modified: llvm/trunk/lib/Transforms/Scalar/SROA.cpp
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/lib/Transforms/Scalar/SROA.cpp?rev=277969&r1=277968&
> r2=277969&view=diff
> =======================================================================
> =======
> --- llvm/trunk/lib/Transforms/Scalar/SROA.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/SROA.cpp Sun Aug 7 20:30:53 2016
> @@ -2890,7 +2890,13 @@ private:
>
> (void)New;
> DEBUG(dbgs() << " to: " << *New << "\n");
> - return true;
> +
> + // Lifetime intrinsics are only promotable if they cover the whole
> alloca.
> + // (In theory, intrinsics which partially cover an alloca could be
> + // promoted, but PromoteMemToReg doesn't handle that case.)
> + bool IsWholeAlloca = NewBeginOffset == NewAllocaBeginOffset &&
> + NewEndOffset == NewAllocaEndOffset;
> + return IsWholeAlloca;
> }
>
> bool visitPHINode(PHINode &PN) {
>
> Modified: llvm/trunk/test/Transforms/SROA/basictest.ll
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/trunk/test/Transforms/SROA/basictest.ll?rev=277969&r1=2779
> 68&r2=277969&view=diff
> =======================================================================
> =======
> --- llvm/trunk/test/Transforms/SROA/basictest.ll (original)
> +++ llvm/trunk/test/Transforms/SROA/basictest.ll Sun Aug 7 20:30:53
> +++ 2016
> @@ -1669,3 +1669,18 @@ entry:
> }
>
> declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture,
> i64, i32, i1) nounwind
> +
> +define void @PR27999() unnamed_addr {
> +; CHECK-LABEL: @PR27999(
> +; CHECK: alloca [2 x i64], align 8
> +; CHECK: call void @llvm.lifetime.start(i64 16, ; CHECK: call void
> + at llvm.lifetime.end(i64 8,
> +entry-block:
> + %0 = alloca [2 x i64], align 8
> + %1 = bitcast [2 x i64]* %0 to i8*
> + call void @llvm.lifetime.start(i64 16, i8* %1)
> + %2 = getelementptr inbounds [2 x i64], [2 x i64]* %0, i32 0, i32 1
> + %3 = bitcast i64* %2 to i8*
> + call void @llvm.lifetime.end(i64 8, i8* %3)
> + ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list