forked from OSchip/llvm-project
[VENTUS][RISCV] Fix move instructions after JOIN move forward bug
1. If the move instruction needs to be moved forward, it will only be inserted after the last corresponding move instruction in the predecessor basic block. 2. The first instruction of the predecessor is also counted as a possible insertion point.
This commit is contained in:
parent
078bb26e2e
commit
f781479b52
|
@ -236,8 +236,20 @@ bool VentusInsertJoinToVBranch::checkJoinMBB(MachineBasicBlock &MBB) const {
|
|||
if (&MI1 == &Def)
|
||||
Insert = MI1.getIterator();
|
||||
}
|
||||
if (Insert != Pre->begin()) {
|
||||
if (Insert != Pre->begin() || Pre->begin() == &Def) {
|
||||
// Last instruction define in Pre MBB
|
||||
bool IsInsert = false;
|
||||
for(auto Pair : MBBMaybeInsertedInstr) {
|
||||
if (Pair.first == Pre) {
|
||||
IsInsert = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Only last MI in Pre need to insert
|
||||
if (IsInsert)
|
||||
continue;
|
||||
|
||||
NeedToBeInsertMBBNum++;
|
||||
MBBMaybeInsertedInstr.push_back({Pre, Insert});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue