[llvm] r351022 - [LegalizeDAG] Remove 'NeedInvert' code from expansion of BR_CC. Replace with an assert.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 13 11:33:30 PST 2019


Author: ctopper
Date: Sun Jan 13 11:33:30 2019
New Revision: 351022

URL: http://llvm.org/viewvc/llvm-project?rev=351022&view=rev
Log:
[LegalizeDAG] Remove 'NeedInvert' code from expansion of BR_CC. Replace with an assert.

I accidentally triggered this code while doing some experiments and it doesn't look lke it could possibly work.

It calls 'getNOT' on a node that should be a CondCode.

I think to do this right we would need to swap the branch target and the fallthrough target. But that's not easy to do. Or we could create an explicit SetCC and feed that into a new BR_CC?

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=351022&r1=351021&r2=351022&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Sun Jan 13 11:33:30 2019
@@ -3685,10 +3685,7 @@ bool SelectionDAGLegalize::ExpandNode(SD
     (void)Legalized;
     assert(Legalized && "Can't legalize BR_CC with legal condition!");
 
-    // If we expanded the SETCC by inverting the condition code, then wrap
-    // the existing SETCC in a NOT to restore the intended condition.
-    if (NeedInvert)
-      Tmp4 = DAG.getNOT(dl, Tmp4, Tmp4->getValueType(0));
+    assert(!NeedInvert && "Don't know how to invert BR_CC!");
 
     // If we expanded the SETCC by swapping LHS and RHS, create a new BR_CC
     // node.




More information about the llvm-commits mailing list