-
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
[AIEX] Shift G_CONCAT_VECTORS closer to the user #234
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1367,10 +1367,25 @@ bool llvm::matchUpdToConcat(MachineInstr &MI, MachineRegisterInfo &MRI, | |
return true; | ||
} | ||
|
||
/// Find a use of \p MI in the same block where it can be moved | ||
MachineInstr &findClosestToUseInsertPoint(MachineInstr &MI, | ||
MachineRegisterInfo &MRI) { | ||
|
||
for (auto &User : MRI.use_instructions(MI.getOperand(0).getReg())) { | ||
if (User.isPHI()) | ||
continue; | ||
if (User.getParent() == MI.getParent() && canDelayMemOp(MI, User, MRI)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Super-nit: I think we should really rename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, because it sounds strange to use it for non-memory instructions. On the other hand, this function check specific side effects of crossing memory operations, differently from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can leave it like this, it might just be a bit too conservative when encountering a store. We will need to revamp it as to point anyway if we want the combiners to move past certain intrinsics with side effects. |
||
return User; | ||
} | ||
|
||
return MI; | ||
} | ||
|
||
void llvm::applyUpdToConcat(MachineInstr &MI, MachineRegisterInfo &MRI, | ||
MachineIRBuilder &B, | ||
std::map<unsigned, Register> &IndexRegMap) { | ||
B.setInstrAndDebugLoc(MI); | ||
B.setDebugLoc(MI.getDebugLoc()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why aren't the debug location and insertion point for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @F-Stuckmann , in this case, the goal is to retain the same debug information (related to the instruction that we are replacing), but building the instruction in a different (shifted) position. |
||
B.setInstr(findClosestToUseInsertPoint(MI, MRI)); | ||
|
||
SmallVector<Register, 4> SrcRegs; | ||
for (unsigned Op = 0; Op < IndexRegMap.size(); Op++) { | ||
|
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.
Nit: Maybe add a top-level comment like
Find a use of \p MI in the same block where it can be moved