Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/MachineCopyPropagation.cpp | ||
---|---|---|
94 | Period. | |
100 | Although I doubt it happens in practice, MIs might have several RegMask operands. | |
262–263 | Update this comment, the end is no more relevant. | |
291 | We could factorize the two previous loops into a helper function. |
This is an updated version which simply removes the NoInterveningSideEffects(). From the commit description:
This also simplifies the code by removing the overly conservative
NoInterveningSideEffect() function. This function checked:
- That the two copies belong to the same block: We only process one block at a time and clear our maps in between it is impossible to find a copy from a different block.
- There is no terminator between the two copy instructions: This is not allowed anyway (the MachineVerifier would complain)
- Does not have instructions with hasUnmodeledSideEffects() or isCall() set: Even for those instructuction we must have all clobbers/defs of registers explicit as an operand. If the register is explicitely clobbered we would never come to the point of checking for NoInterveningSideEffect() anyway.
(I also checked this with a temporary build of the test-suite with all
potentially failing conditions in NoInterveningSideEffect() turned into
asserts)
lib/CodeGen/MachineCopyPropagation.cpp | ||
---|---|---|
285–290 | This code looks same as the last part of SourceNoLongerAvailable(). We could make a helper function shared in here and in SourceNoLongerAvailable(). |
Hi Matthias,
Nice clean up.
Looks good to me, modulo my inlined comments for the test cases.
Please also look into Jun's comment.
Thanks,
-Quentin
test/CodeGen/X86/machine-copy-prop.mir | ||
---|---|---|
8 | Could you add a comment on what this function is testing? | |
21 | Add another test where the copy cannot be propagated because of clobbered registers. |
New revision which splits SourceNoLongerAvailable() into two new functions: ClobberCopySources(), ClobberRegister() so the code that is now in ClobberCopySources() can be reused for the regmask case.
The tests have also been extended to cover negative cases and check for kill flag clearing.
lib/CodeGen/MachineCopyPropagation.cpp | ||
---|---|---|
93 | Any reason why the two loops are not merged? | |
129 | I was wondering if it would be more efficient to traverse the clobbered registers and erase the entries in the map accordingly, but I figured the map is usually pretty small. | |
test/CodeGen/X86/machine-copy-prop.mir | ||
1 | -verify-machineinstrs? | |
13 | typo -> redundant |
Thanks for the reviews. New version addressing the comments.
lib/CodeGen/MachineCopyPropagation.cpp | ||
---|---|---|
74 | Renamed it to removeRegsFromMap() and transformed it into a static function similar to removeClobberedRegsFromMap() | |
93 | No, they previously just haven't been that close together and not 100% the same, so I didn't see it. | |
129 | Yes that it is indeed the reason, I will add a comment. | |
286 | indeed, fixed. | |
test/CodeGen/X86/machine-copy-prop.mir | ||
1 | Turned out -verify-machineinstrs is a separate pass and won't run anyway when "llc -run-pass XXX" is used. Fixing that is for another commit. |
I doubt if this method name well describe what it does. For me this method seems simply erase all (sub)regs in RegList from AvailCopyMap.