Skip to content

Commit 96aaebd

Browse files
author
Kai Luo
committed
[MachineCopyPropagation] Eliminate spillage copies that might be caused by eviction chain
Remove spill-reload like copy chains. For example ``` r0 = COPY r1 r1 = COPY r2 r2 = COPY r3 r3 = COPY r4 <def-use r4> r4 = COPY r3 r3 = COPY r2 r2 = COPY r1 r1 = COPY r0 ``` will be folded into ``` r0 = COPY r1 r1 = COPY r4 <def-use r4> r4 = COPY r1 r1 = COPY r0 ``` Reviewed By: qcolombet Differential Revision: https://reviews.llvm.org/D122118
1 parent 472393e commit 96aaebd

File tree

4 files changed

+660
-3
lines changed

4 files changed

+660
-3
lines changed

llvm/include/llvm/CodeGen/TargetSubtargetInfo.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ class TargetSubtargetInfo : public MCSubtargetInfo {
318318
classifyGlobalFunctionReference(const GlobalValue *GV) const {
319319
return 0;
320320
}
321+
322+
/// Enable spillage copy elimination in MachineCopyPropagation pass. This
323+
/// helps removing redundant copies generated by register allocator when
324+
/// handling complex eviction chains.
325+
virtual bool enableSpillageCopyElimination() const { return false; }
321326
};
322327

323328
} // end namespace llvm

0 commit comments

Comments
 (0)