[release_40 branch] Merge Request of r293658 - Don't combine stores to a swifterror pointer operand to a different type

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 14:50:49 PST 2017


David: wdyt?

On Tue, Jan 31, 2017 at 12:40 PM, Arnold Schwaighofer via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> I would like to propose merging the patch below into the release branch.
>
> The patch affects only code that uses the ‘swifterror’ attribute — code
> generated by the swift compiler.
>
>
> Begin forwarded message:
>
> From: Arnold Schwaighofer via llvm-commits <llvm-commits at lists.llvm.org>
> Subject: [llvm] r293658 - Don't combine stores to a swifterror pointer
> operand to a different type
> Date: January 31, 2017 at 9:53:50 AM PST
> To: llvm-commits at lists.llvm.org
> Reply-To: Arnold Schwaighofer <aschwaighofer at apple.com>
>
> Author: arnolds
> Date: Tue Jan 31 11:53:49 2017
> New Revision: 293658
>
> URL: http://llvm.org/viewvc/llvm-project?rev=293658&view=rev
> Log:
> Don't combine stores to a swifterror pointer operand to a different type
>
> Modified:
>    llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
>    llvm/trunk/test/Transforms/InstCombine/load.ll
>
> Modified:
> llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp?rev=293658&r1=293657&r2=293658&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp
> (original)
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp Tue
> Jan 31 11:53:49 2017
> @@ -502,7 +502,8 @@ static Instruction *combineLoadToOperati
>       !DL.isNonIntegralPointerType(Ty)) {
>     if (all_of(LI.users(), [&LI](User *U) {
>           auto *SI = dyn_cast<StoreInst>(U);
> -          return SI && SI->getPointerOperand() != &LI;
> +          return SI && SI->getPointerOperand() != &LI &&
> +                 !SI->getPointerOperand()->isSwiftError();
>         })) {
>       LoadInst *NewLoad = combineLoadToNewType(
>           IC, LI,
>
> Modified: llvm/trunk/test/Transforms/InstCombine/load.ll
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/load.ll?rev=293658&r1=293657&r2=293658&view=diff
> ==============================================================================
> --- llvm/trunk/test/Transforms/InstCombine/load.ll (original)
> +++ llvm/trunk/test/Transforms/InstCombine/load.ll Tue Jan 31 11:53:49 2017
> @@ -219,3 +219,22 @@ entry:
>   store %swift.error* %err.res, %swift.error** %err, align 8
>   ret void
> }
> +
> +; Make sure we preseve the type of the store to a swifterror pointer.
> +; CHECK-LABEL: @test19(
> +; CHECK: [[A:%.*]] = alloca
> +; CHECK: call
> +; CHECK: [[BC:%.*]] = bitcast i8** [[A]] to
> +; CHECK: [[ERRVAL:%.*]] =  load {{.*}}[[BC]]
> +; CHECK: store {{.*}}[[ERRVAL]]
> +; CHECK: ret
> +declare void @initi8(i8**)
> +define void @test19(%swift.error** swifterror %err) {
> +entry:
> +  %tmp = alloca i8*, align 8
> +  call void @initi8(i8** %tmp)
> +  %swifterror = bitcast i8** %tmp to %swift.error**
> +  %err.res = load %swift.error*, %swift.error** %swifterror, align 8
> +  store %swift.error* %err.res, %swift.error** %err, align 8
> +  ret void
> +}
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
>
> _______________________________________________
> 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