-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AIE2P] Fix Accumulator Register Bank assignment for G_STORE #264
base: aie-public
Are you sure you want to change the base?
Conversation
} | ||
return -1; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, can you add a test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't add a test triggering this bug because there is no intrinsic that ouputs an accumulator at index zero. but we can't assume that VReg
is always defined at index 0 of DefMI
as we don't know what DefMI will be.
( See replaced line: auto *RB = getRegBank(DefMI->getOperand(0).getReg(), MRI, TRI)
)
@@ -766,11 +777,13 @@ AIE2PRegisterBankInfo::getInstrMapping(const MachineInstr &MI) const { | |||
break; | |||
MachineInstr *DefMI = MRI.getVRegDef(VReg); | |||
LLT Type = MRI.getType(VReg); | |||
auto *RB = getRegBank(DefMI->getOperand(0).getReg(), MRI, TRI); | |||
auto DefRegBank = getRegBank( | |||
DefMI->getOperand(getVRegIndexInInstr(*DefMI, VReg)).getReg(), MRI, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is DefMI->getOperand(getVRegIndexInInstr(*DefMI, VReg)).getReg()
same as VReg
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DefMI->getOperand(getVRegIndexInInstr(*DefMI, VReg)).getReg()
is an operand and VReg
is a register. So they cannot be the same.
return i; | ||
} | ||
} | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about a std::optional
? This -1 looks dangerous regarding alternative uses.
For
G_STORE
, we look at the bank of the register in the defining instruction but we assume that this will be at index zero, which has been the case for AIE2P's intrinsics defining accumulators but not true in general.