<div dir="ltr">Sure, feel free to revert.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 17, 2014 at 4:17 PM, Manman Ren <span dir="ltr"><<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Hi David,<br>
<br>
I think this breaks the public stage2 builedbot: <a href="http://lab.llvm.org:8080/green/job/clang-Rlto_master/298/" target="_blank">http://lab.llvm.org:8080/green/job/clang-Rlto_master/298/</a><br>
<br>
r222039 builds fine, but r222040 does not, from my local debugging.<br>
<br>
Can we revert this commit and see if the bot becomes green?<br>
<br>
Thanks,<br>
Manman<br>
<div class="HOEnZb"><div class="h5"><br>
> On Nov 14, 2014, at 1:21 PM, David Majnemer <<a href="mailto:david.majnemer@gmail.com">david.majnemer@gmail.com</a>> wrote:<br>
><br>
> Author: majnemer<br>
> Date: Fri Nov 14 15:21:15 2014<br>
> New Revision: 222040<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=222040&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=222040&view=rev</a><br>
> Log:<br>
> InstCombine: Fix infinite loop caused by visitFPTrunc<br>
><br>
> We would attempt to replace a fptrunc of an frem with an identical<br>
> fptrunc.  This would cause the new fptrunc to be added to the worklist.<br>
> Of course, this results in an infinite loop because we will keep<br>
> visiting the newly created fptruncs.<br>
><br>
> This fixes PR21576.<br>
><br>
> Modified:<br>
>    llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp<br>
>    llvm/trunk/test/Transforms/InstCombine/fpcast.ll<br>
><br>
> Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=222040&r1=222039&r2=222040&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=222040&r1=222039&r2=222040&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)<br>
> +++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Fri Nov 14 15:21:15 2014<br>
> @@ -1269,14 +1269,17 @@ Instruction *InstCombiner::visitFPTrunc(<br>
>         // type of OpI doesn't enter into things at all.  We simply evaluate<br>
>         // in whichever source type is larger, then convert to the<br>
>         // destination type.<br>
> +        Value *NewLHS = LHSOrig, *NewRHS = RHSOrig;<br>
>         if (LHSWidth < SrcWidth)<br>
> -          LHSOrig = Builder->CreateFPExt(LHSOrig, RHSOrig->getType());<br>
> +          NewLHS = Builder->CreateFPExt(NewLHS, RHSOrig->getType());<br>
>         else if (RHSWidth <= SrcWidth)<br>
> -          RHSOrig = Builder->CreateFPExt(RHSOrig, LHSOrig->getType());<br>
> -        Value *ExactResult = Builder->CreateFRem(LHSOrig, RHSOrig);<br>
> -        if (Instruction *RI = dyn_cast<Instruction>(ExactResult))<br>
> -          RI->copyFastMathFlags(OpI);<br>
> -        return CastInst::CreateFPCast(ExactResult, CI.getType());<br>
> +          NewRHS = Builder->CreateFPExt(NewRHS, LHSOrig->getType());<br>
> +        if (NewLHS != LHSOrig || NewRHS != RHSOrig) {<br>
> +          Value *ExactResult = Builder->CreateFRem(NewLHS, NewRHS);<br>
> +          if (Instruction *RI = dyn_cast<Instruction>(ExactResult))<br>
> +            RI->copyFastMathFlags(OpI);<br>
> +          return CastInst::CreateFPCast(ExactResult, CI.getType());<br>
> +        }<br>
>     }<br>
><br>
>     // (fptrunc (fneg x)) -> (fneg (fptrunc x))<br>
><br>
> Modified: llvm/trunk/test/Transforms/InstCombine/fpcast.ll<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fpcast.ll?rev=222040&r1=222039&r2=222040&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/fpcast.ll?rev=222040&r1=222039&r2=222040&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/test/Transforms/InstCombine/fpcast.ll (original)<br>
> +++ llvm/trunk/test/Transforms/InstCombine/fpcast.ll Fri Nov 14 15:21:15 2014<br>
> @@ -53,3 +53,13 @@ define half @test5(float %a, float %b, f<br>
> }<br>
><br>
> declare float @llvm.fabs.f32(float) nounwind readonly<br>
> +<br>
> +define <1 x float> @test6(<1 x double> %V) {<br>
> +  %frem = frem <1 x double> %V, %V<br>
> +  %trunc = fptrunc <1 x double> %frem to <1 x float><br>
> +  ret <1 x float> %trunc<br>
> +; CHECK-LABEL: @test6<br>
> +; CHECK-NEXT: %[[frem:.*]]  = frem <1 x double> %V, %V<br>
> +; CHECK-NEXT: %[[trunc:.*]] = fptrunc <1 x double> %[[frem]] to <1 x float><br>
> +; CHECK-NEXT: ret <1 x float> %trunc<br>
> +}<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</div></div></blockquote></div><br></div>