Skip to content

Commit d2170a9

Browse files
author
gkoehler
committed
Unbreak clang 19 (compiled by 19) on macppc
clang 19 was miscompiling its own llvm::MergeBasicBlockIntoOnlyPred (Transform/Utils/Local.cpp). A change between clang 18 and 19 exposed a mistake in BitPermutationSelector (PPCISelDAGToDAG.cpp). It optimized away a permutation (rotate all 32 bits left by 0) and got result number 1 from a load pre-inc SDNode, but the node replacement assumed result number 0. Kludge by adding an extra node. llvm/llvm-project#133507 llvm/llvm-project#151429 This isn't the best fix. I will replace it if LLVM commits a different fix. ok miod@
1 parent ed576cb commit d2170a9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gnu/llvm/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2337,6 +2337,11 @@ class BitPermutationSelector {
23372337
ANDIVal, ANDISVal), 0);
23382338
}
23392339

2340+
// Caller assumes ResNo == 0, but we might have ResNo != 0 after
2341+
// optimizing away a permutation. Kludge with an extra node.
2342+
if (Res.getResNo() != 0)
2343+
return CurDAG->getMachineNode(PPC::OR, dl, MVT::i32, Res, Res);
2344+
23402345
return Res.getNode();
23412346
}
23422347

0 commit comments

Comments
 (0)