Skip to content

Commit 2625094

Browse files
committed
Must delete from all predecessors if lowering.
1 parent 4492864 commit 2625094

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

llvm/lib/Target/AMDGPU/SICustomBranchBundles.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,18 @@ static inline void normalize_ir_post_phi_elimination(MachineFunction &MF) {
163163

164164
// Handle the last potential rewrite entry. Lower instead of journaling a
165165
// rewrite entry if all predecessor MBBs are in this single entry.
166-
if (to_insert.pred_MBBs.size() == MBB.pred_size())
167-
// Lower
168-
move_body(to_insert.body,MBB);
166+
if (to_insert.pred_MBBs.size() == MBB.pred_size()) {
167+
move_body(to_insert.body, MBB);
168+
for (MachineBasicBlock *pred_MBB : to_insert.pred_MBBs) {
169+
// Delete instructions that were lowered from epilog
170+
MachineInstr &branch_ins =
171+
get_branch_with_dest(*pred_MBB, *to_insert.succ_MBB);
172+
auto epilog_it = ++Epilog_Iterator(branch_ins.getIterator());
173+
while (!epilog_it.isEnd())
174+
epilog_it++->eraseFromBundle();
175+
}
176+
177+
}
169178
else if (to_insert.body.size())
170179
cfg_rewrite_entries.push_back(to_insert);
171180
}

0 commit comments

Comments
 (0)