@@ -2837,34 +2837,7 @@ void SelectionDAGBuilder::visitBr(const BranchInst &I) {
28372837 Opcode = Instruction::And;
28382838 else if (match (BOp, m_LogicalOr (m_Value (BOp0), m_Value (BOp1))))
28392839 Opcode = Instruction::Or;
2840- auto &TLI = DAG.getTargetLoweringInfo();
2841- const auto checkSRLIPM = [&TLI](const SDValue &Op) {
2842- if (!Op.getNumOperands())
2843- return false;
2844- SDValue OpVal = Op.getOperand(0);
2845- SDNode *N = OpVal.getNode();
2846- if (N && N->getOpcode() == ISD::SRL)
2847- return TLI.canLowerSRL_IPM_Switch(OpVal);
2848- else if (N && OpVal.getNumOperands() &&
2849- (N->getOpcode() == ISD::AND || N->getOpcode() == ISD::OR)) {
2850- SDValue OpVal1 = OpVal.getOperand(0);
2851- SDNode *N1 = OpVal1.getNode();
2852- if (N1 && N1->getOpcode() == ISD::SRL)
2853- return TLI.canLowerSRL_IPM_Switch(OpVal1);
2854- }
2855- return false;
2856- };
2857- // Incoming IR here is straight line code, FindMergedConditions splits
2858- // condition code sequence across Basic Block. DAGCombiner can't combine
2859- // across Basic Block. Identify SRL/IPM/CC sequence for SystemZ and avoid
2860- // transformation in FindMergedConditions.
2861- bool BrSrlIPM = false;
2862- if (NodeMap.count(BOp0) && NodeMap[BOp0].getNode()) {
2863- BrSrlIPM |= checkSRLIPM(getValue(BOp0));
2864- if (NodeMap.count(BOp1) && NodeMap[BOp1].getNode())
2865- BrSrlIPM &= checkSRLIPM(getValue(BOp1));
2866- }
2867- if (Opcode && !BrSrlIPM &&
2840+ if (Opcode &&
28682841 !(match (BOp0, m_ExtractElt (m_Value (Vec), m_Value ())) &&
28692842 match (BOp1, m_ExtractElt (m_Specific (Vec), m_Value ()))) &&
28702843 !shouldKeepJumpConditionsTogether (
@@ -12138,36 +12111,19 @@ void SelectionDAGBuilder::lowerWorkItem(SwitchWorkListItem W, Value *Cond,
1213812111 const APInt &SmallValue = Small.Low ->getValue ();
1213912112 const APInt &BigValue = Big.Low ->getValue ();
1214012113
12141- // Incoming IR is switch table.Identify SRL/IPM/CC sequence for SystemZ
12142- // and we want to avoid splitting condition code sequence across basic
12143- // block for cases like (CC == 0) || (CC == 2) || (CC == 3), or
12144- // (CC == 0) || (CC == 1) ^ (CC == 3), there could potentially be
12145- // more cases like this.
12146- const TargetLowering &TLI = DAG.getTargetLoweringInfo();
12147- bool IsSrlIPM = false;
12148- if (NodeMap.count(Cond) && NodeMap[Cond].getNode())
12149- IsSrlIPM = TLI.canLowerSRL_IPM_Switch(getValue(Cond));
1215012114 // Check that there is only one bit different.
1215112115 APInt CommonBit = BigValue ^ SmallValue;
12152- if (CommonBit.isPowerOf2() || IsSrlIPM ) {
12116+ if (CommonBit.isPowerOf2 ()) {
1215312117 SDValue CondLHS = getValue (Cond);
1215412118 EVT VT = CondLHS.getValueType ();
1215512119 SDLoc DL = getCurSDLoc ();
1215612120 SDValue Cond;
1215712121
12158- if (CommonBit.isPowerOf2()) {
12159- SDValue Or = DAG.getNode(ISD::OR, DL, VT, CondLHS,
12160- DAG.getConstant(CommonBit, DL, VT));
12161- Cond = DAG.getSetCC(DL, MVT::i1, Or,
12162- DAG.getConstant(BigValue | SmallValue, DL, VT),
12163- ISD::SETEQ);
12164- } else if (IsSrlIPM && BigValue == 3 && SmallValue == 0) {
12165- SDValue SetCC =
12166- DAG.getSetCC(DL, MVT::i32, CondLHS,
12167- DAG.getConstant(SmallValue, DL, VT), ISD::SETEQ);
12168- Cond = DAG.getSetCC(DL, MVT::i32, SetCC,
12169- DAG.getConstant(BigValue, DL, VT), ISD::SETEQ);
12170- }
12122+ SDValue Or = DAG.getNode (ISD::OR, DL, VT, CondLHS,
12123+ DAG.getConstant (CommonBit, DL, VT));
12124+ Cond = DAG.getSetCC (DL, MVT::i1, Or,
12125+ DAG.getConstant (BigValue | SmallValue, DL, VT),
12126+ ISD::SETEQ);
1217112127
1217212128 // Update successor info.
1217312129 // Both Small and Big will jump to Small.BB, so we sum up the
0 commit comments