llvm.org GIT mirror llvm / 9920bd3
Revert r162101 and replace it with a solution that works for targets where the pointer type is illegal. This is a horrible bit of code. We're calling a simplification routine *in the middle* of type legalization. We tell the simplification routine that it's running after legalization, but some of the types it will encounter will be illegal! The fix is only to invoke the simplification if the types in question were legal, so that none of its invariants will be violated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@199847 91177308-0d34-0410-b5e6-96231b3b80d8 Owen Anderson 6 years ago
3 changed file(s) with 12 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
25762576 // this identity: (B1 ? B2 : B3) --> (B1 & B2)|(!B1&B3)
25772577 TargetLowering::DAGCombinerInfo DagCombineInfo(DAG, AfterLegalizeTypes, true, NULL);
25782578 SDValue Tmp1, Tmp2;
2579 Tmp1 = TLI.SimplifySetCC(getSetCCResultType(LHSLo.getValueType()),
2580 LHSLo, RHSLo, LowCC, false, DagCombineInfo, dl);
2579 if (TLI.isTypeLegal(LHSLo.getValueType()) &&
2580 TLI.isTypeLegal(RHSLo.getValueType()))
2581 Tmp1 = TLI.SimplifySetCC(getSetCCResultType(LHSLo.getValueType()),
2582 LHSLo, RHSLo, LowCC, false, DagCombineInfo, dl);
25812583 if (!Tmp1.getNode())
25822584 Tmp1 = DAG.getSetCC(dl, getSetCCResultType(LHSLo.getValueType()),
25832585 LHSLo, RHSLo, LowCC);
2584 Tmp2 = TLI.SimplifySetCC(getSetCCResultType(LHSHi.getValueType()),
2585 LHSHi, RHSHi, CCCode, false, DagCombineInfo, dl);
2586 if (TLI.isTypeLegal(LHSHi.getValueType()) &&
2587 TLI.isTypeLegal(RHSHi.getValueType()))
2588 Tmp2 = TLI.SimplifySetCC(getSetCCResultType(LHSHi.getValueType()),
2589 LHSHi, RHSHi, CCCode, false, DagCombineInfo, dl);
25862590 if (!Tmp2.getNode())
25872591 Tmp2 = DAG.getNode(ISD::SETCC, dl,
25882592 getSetCCResultType(LHSHi.getValueType()),
15351535 N0.getOpcode() == ISD::AND)
15361536 if (ConstantSDNode *AndRHS =
15371537 dyn_cast(N0.getOperand(1))) {
1538 EVT ShiftTy = DCI.isBeforeLegalizeOps() ?
1538 EVT ShiftTy = DCI.isBeforeLegalize() ?
15391539 getPointerTy() : getShiftAmountTy(N0.getValueType());
15401540 if (Cond == ISD::SETNE && C1 == 0) {// (X & 8) != 0 --> (X & 8) >> 3
15411541 // Perform the xform if the AND RHS is a single bit.
15651565 const APInt &AndRHSC = AndRHS->getAPIntValue();
15661566 if ((-AndRHSC).isPowerOf2() && (AndRHSC & C1) == C1) {
15671567 unsigned ShiftBits = AndRHSC.countTrailingZeros();
1568 EVT ShiftTy = DCI.isBeforeLegalizeOps() ?
1568 EVT ShiftTy = DCI.isBeforeLegalize() ?
15691569 getPointerTy() : getShiftAmountTy(N0.getValueType());
15701570 EVT CmpTy = N0.getValueType();
15711571 SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0.getOperand(0),
15931593 }
15941594 NewC = NewC.lshr(ShiftBits);
15951595 if (ShiftBits && isLegalICmpImmediate(NewC.getSExtValue())) {
1596 EVT ShiftTy = DCI.isBeforeLegalizeOps() ?
1596 EVT ShiftTy = DCI.isBeforeLegalize() ?
15971597 getPointerTy() : getShiftAmountTy(N0.getValueType());
15981598 EVT CmpTy = N0.getValueType();
15991599 SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0,
2626
2727 ; CHECK-LABEL: fn1:
2828 ; CHECK: shrq $32, [[REG:%.*]]
29 ; CHECK: je
29 ; CHECK: sete
3030 }