<div dir="ltr">Looks like that wasn't sufficient, I've uploaded <a href="https://reviews.llvm.org/D77911">https://reviews.llvm.org/D77911</a> as a harder hammer.<div><br></div><div>-eric</div></div><div dir="ltr"></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 8, 2020 at 5:57 AM Sanjay Patel via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Sanjay Patel<br>
Date: 2020-04-08T08:56:19-04:00<br>
New Revision: a1c05fe20f3def1f1be9f50d2adefc6b6f1578ad<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/a1c05fe20f3def1f1be9f50d2adefc6b6f1578ad" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/a1c05fe20f3def1f1be9f50d2adefc6b6f1578ad</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/a1c05fe20f3def1f1be9f50d2adefc6b6f1578ad.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/a1c05fe20f3def1f1be9f50d2adefc6b6f1578ad.diff</a><br>
<br>
LOG: [InstCombine] exclude bitcast of ppc_fp128 in icmp signbit fold<br>
<br>
Based on the post-commit comments for rG0f56bbc, there might<br>
be a problem with this transform:<br>
<br>
(bitcast (fpext/fptrunc X)) to iX) < 0 --> (bitcast X to iY) < 0<br>
<br>
...and the ppc_fp128 data type, so conservatively bypass if we<br>
are bitcasting a ppc_fp128.<br>
<br>
We might be able to account for endian or other differences to<br>
enable this for PowerPC again if that is useful.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D77642" rel="noreferrer" target="_blank">https://reviews.llvm.org/D77642</a><br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
    llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp<br>
    llvm/test/Transforms/InstCombine/icmp.ll<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp<br>
index bb7d0c930755..e1e262821ef8 100644<br>
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp<br>
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp<br>
@@ -2763,11 +2763,13 @@ static Instruction *foldICmpBitCast(ICmpInst &Cmp,<br>
         return new ICmpInst(Pred, X, ConstantInt::getNullValue(X->getType()));<br>
<br>
     // If this is a sign-bit test of a bitcast of a casted FP value, eliminate<br>
-    // the FP cast because the FP cast does not change the sign-bit.<br>
+    // the FP extend/truncate because that cast does not change the sign-bit.<br>
+    // This is true for all standard IEEE-754 types and the X86 80-bit type.<br>
+    // The sign-bit is always the most significant bit in those types.<br>
     const APInt *C;<br>
     bool TrueIfSigned;<br>
-    if (match(Op1, m_APInt(C)) && Bitcast->hasOneUse() &&<br>
-        isSignBitCheck(Pred, *C, TrueIfSigned)) {<br>
+    if (!BCSrcOp->getType()->isPPC_FP128Ty() && match(Op1, m_APInt(C)) &&<br>
+        Bitcast->hasOneUse() && isSignBitCheck(Pred, *C, TrueIfSigned)) {<br>
       if (match(BCSrcOp, m_FPExt(m_Value(X))) ||<br>
           match(BCSrcOp, m_FPTrunc(m_Value(X)))) {<br>
         // (bitcast (fpext/fptrunc X)) to iX) < 0 --> (bitcast X to iY) < 0<br>
<br>
diff  --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll<br>
index 2da5c696d046..96673eb9e451 100644<br>
--- a/llvm/test/Transforms/InstCombine/icmp.ll<br>
+++ b/llvm/test/Transforms/InstCombine/icmp.ll<br>
@@ -3700,8 +3700,9 @@ define i1 @signbit_bitcast_fpext_extra_use(float %x, i64* %p) {<br>
<br>
 define i1 @signbit_bitcast_fpext_ppc_fp128(float %x) {<br>
 ; CHECK-LABEL: @signbit_bitcast_fpext_ppc_fp128(<br>
-; CHECK-NEXT:    [[TMP1:%.*]] = bitcast float [[X:%.*]] to i32<br>
-; CHECK-NEXT:    [[S4:%.*]] = icmp slt i32 [[TMP1]], 0<br>
+; CHECK-NEXT:    [[S2:%.*]] = fpext float [[X:%.*]] to ppc_fp128<br>
+; CHECK-NEXT:    [[S3:%.*]] = bitcast ppc_fp128 [[S2]] to i128<br>
+; CHECK-NEXT:    [[S4:%.*]] = icmp slt i128 [[S3]], 0<br>
 ; CHECK-NEXT:    ret i1 [[S4]]<br>
 ;<br>
   %s2 = fpext float %x to ppc_fp128<br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>