<div dir="rtl"><div dir="ltr">This fixed <a href="http://llvm.org/pr25577">http://llvm.org/pr25577</a>, thanks!</div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-11-20 10:16 GMT+02:00 Owen Anderson via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: resistor<br>
Date: Fri Nov 20 02:16:13 2015<br>
New Revision: 253655<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=253655&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=253655&view=rev</a><br>
Log:<br>
Fix a pair of issues that caused an infinite loop in reassociate.<br>
<br>
Terrifyingly, one of them is a mishandling of floating point vectors<br>
in Constant::isZero(). How exactly this issue survived this long<br>
is beyond me.<br>
<br>
Added:<br>
llvm/trunk/test/Transforms/Reassociate/fp-expr.ll<br>
Modified:<br>
llvm/trunk/lib/IR/Constants.cpp<br>
llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp<br>
<br>
Modified: llvm/trunk/lib/IR/Constants.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Constants.cpp?rev=253655&r1=253654&r2=253655&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Constants.cpp?rev=253655&r1=253654&r2=253655&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/IR/Constants.cpp (original)<br>
+++ llvm/trunk/lib/IR/Constants.cpp Fri Nov 20 02:16:13 2015<br>
@@ -68,6 +68,12 @@ bool Constant::isZeroValue() const {<br>
if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this))<br>
return CFP->isZero();<br>
<br>
+ // Equivalent for a vector of -0.0's.<br>
+ if (const ConstantDataVector *CV = dyn_cast<ConstantDataVector>(this))<br>
+ if (ConstantFP *SplatCFP = dyn_cast_or_null<ConstantFP>(CV->getSplatValue()))<br>
+ if (SplatCFP && SplatCFP->isZero())<br>
+ return true;<br>
+<br>
// Otherwise, just use +0.0.<br>
return isNullValue();<br>
}<br>
<br>
Modified: llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=253655&r1=253654&r2=253655&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp?rev=253655&r1=253654&r2=253655&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Scalar/Reassociate.cpp Fri Nov 20 02:16:13 2015<br>
@@ -2064,7 +2064,7 @@ void Reassociate::OptimizeInst(Instructi<br>
return;<br>
<br>
// Don't optimize floating point instructions that don't have unsafe algebra.<br>
- if (I->getType()->isFloatingPointTy() && !I->hasUnsafeAlgebra())<br>
+ if (I->getType()->isFPOrFPVectorTy() && !I->hasUnsafeAlgebra())<br>
return;<br>
<br>
// Do not reassociate boolean (i1) expressions. We want to preserve the<br>
<br>
Added: llvm/trunk/test/Transforms/Reassociate/fp-expr.ll<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fp-expr.ll?rev=253655&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/fp-expr.ll?rev=253655&view=auto</a><br>
==============================================================================<br>
--- llvm/trunk/test/Transforms/Reassociate/fp-expr.ll (added)<br>
+++ llvm/trunk/test/Transforms/Reassociate/fp-expr.ll Fri Nov 20 02:16:13 2015<br>
@@ -0,0 +1,20 @@<br>
+; RUN: opt -S -reassociate < %s | FileCheck %s<br>
+<br>
+define void @test1() {<br>
+; CHECK-LABEL: @test1<br>
+; CHECK: call<br>
+; CHECK: fsub<br>
+; CHECK: fadd<br>
+ %tmp = tail call <4 x float> @blam()<br>
+ %tmp23 = fsub fast <4 x float> undef, %tmp<br>
+ %tmp24 = fadd fast <4 x float> %tmp23, undef<br>
+ tail call void @wombat(<4 x float> %tmp24)<br>
+ ret void<br>
+}<br>
+<br>
+; Function Attrs: optsize<br>
+declare <4 x float> @blam()<br>
+<br>
+; Function Attrs: optsize<br>
+declare void @wombat(<4 x float>)<br>
+<br>
<br>
<br>
_______________________________________________<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/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>