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