Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
lib/CodeGen/MachineCopyPropagation.cpp | ||
---|---|---|
99 | Period. | |
105 | Although I doubt it happens in practice, MIs might have several RegMask operands. | |
278 | Update this comment, the end is no more relevant. | |
307 | 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 | ||
---|---|---|
301–306 | 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 | ||
---|---|---|
9 | Could you add a comment on what this function is testing? | |
22 | 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 | ||
---|---|---|
98 | Any reason why the two loops are not merged? | |
147 | 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 | ||
---|---|---|
73 | Renamed it to removeRegsFromMap() and transformed it into a static function similar to removeClobberedRegsFromMap() | |
98 | No, they previously just haven't been that close together and not 100% the same, so I didn't see it. | |
147 | Yes that it is indeed the reason, I will add a comment. | |
334 | 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.