[llvm] [SelectionDAG] Avoid redundant comparisons in bit-test switch lowering (PR #222626)
Shreeyash Pandey via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 06:00:07 PDT 2026
================
@@ -12536,20 +12534,45 @@ void SelectionDAGBuilder::lowerWorkItem(SwitchWorkListItem W, Value *Cond,
for (CaseClusterIt I = W.FirstCluster; I <= W.LastCluster; ++I)
UnhandledProbs += I->Prob;
- MachineBasicBlock *CurMBB = W.MBB;
- for (CaseClusterIt I = W.FirstCluster, E = W.LastCluster; I <= E; ++I) {
+ // Insert bit-test blocks before the linear work-item continuation blocks so
+ // that pre-creating the latter preserves the existing layout.
+ for (CaseClusterIt I = W.FirstCluster; I <= W.LastCluster; ++I) {
+ if (I->Kind != CC_BitTests)
+ continue;
+ BitTestBlock *BTB = &SL->BitTestCases[I->BTCasesIndex];
----------------
bojle wrote:
Yes. Made the change.
https://github.com/llvm/llvm-project/pull/222626
More information about the llvm-commits
mailing list