Skip to content

Commit e972bc2

Browse files
anoopkg6anoopkg6
authored andcommitted
[SystemZ] Fix linux s390x main can't bootstrap itself on SanitizerSpecialCaseList.cpp #168088 (#168779)
This test has long call chain in recursion. Search tree can be pruned early by swapping CC test and recursive simplifyAssumingCCVal. Fixes: llvm/llvm-project#168088 Co-authored-by: anoopkg6 <[email protected]> Signed-off-by: Hafidz Muzakky <[email protected]>
1 parent 9763c12 commit e972bc2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8673,15 +8673,17 @@ SmallVector<SDValue, 4> static simplifyAssumingCCVal(SDValue &Val, SDValue &CC,
86738673

86748674
int CCValidVal = CCValid->getZExtValue();
86758675
int CCMaskVal = CCMask->getZExtValue();
8676-
const auto &&TrueSDVals = simplifyAssumingCCVal(TrueVal, CC, DAG);
8677-
const auto &&FalseSDVals = simplifyAssumingCCVal(FalseVal, CC, DAG);
8678-
if (TrueSDVals.empty() || FalseSDVals.empty())
8679-
return {};
8676+
// Pruning search tree early - Moving CC test and combineCCMask ahead of
8677+
// recursive call to simplifyAssumingCCVal.
86808678
SDValue Op4CCReg = Val.getOperand(4);
86818679
if (Op4CCReg != CC)
86828680
combineCCMask(Op4CCReg, CCValidVal, CCMaskVal, DAG);
86838681
if (Op4CCReg != CC)
86848682
return {};
8683+
const auto &&TrueSDVals = simplifyAssumingCCVal(TrueVal, CC, DAG);
8684+
const auto &&FalseSDVals = simplifyAssumingCCVal(FalseVal, CC, DAG);
8685+
if (TrueSDVals.empty() || FalseSDVals.empty())
8686+
return {};
86858687
SmallVector<SDValue, 4> MergedSDVals;
86868688
for (auto &CCVal : {0, 1, 2, 3})
86878689
MergedSDVals.emplace_back(((CCMaskVal & (1 << (3 - CCVal))) != 0)

0 commit comments

Comments
 (0)