[PATCH] D70699: [CriticalAntiDepBreaker] Teach the regmask clobber check to check if any subregister is preserved before considering the super register clobbered
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 27 11:23:31 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9283681e1681: [CriticalAntiDepBreaker] Teach the regmask clobber check to check if any… (authored by craig.topper).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70699/new/
https://reviews.llvm.org/D70699
Files:
llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
llvm/test/CodeGen/X86/pr44140.ll
Index: llvm/test/CodeGen/X86/pr44140.ll
===================================================================
--- llvm/test/CodeGen/X86/pr44140.ll
+++ llvm/test/CodeGen/X86/pr44140.ll
@@ -10,7 +10,6 @@
; We need xmm6 to be live from the loop header across all iterations of the loop.
; We shouldn't clobber ymm6 inside the loop.
-; FIXME: We currently clobber ymm6
define i32 @main() {
; CHECK-LABEL: main:
; CHECK: # %bb.0: # %start
@@ -23,7 +22,7 @@
; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm0
; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm1
-; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm6
+; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm7
; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm2
; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm3
; CHECK-NEXT: vmovups %ymm0, {{[0-9]+}}(%rsp)
@@ -31,10 +30,10 @@
; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm1
; CHECK-NEXT: vmovups %ymm3, {{[0-9]+}}(%rsp)
; CHECK-NEXT: vmovups %ymm2, {{[0-9]+}}(%rsp)
-; CHECK-NEXT: vmovups %ymm6, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: vmovups %ymm7, {{[0-9]+}}(%rsp)
; CHECK-NEXT: vmovups %ymm3, {{[0-9]+}}(%rsp)
; CHECK-NEXT: vmovups %ymm2, {{[0-9]+}}(%rsp)
-; CHECK-NEXT: vmovups %ymm6, {{[0-9]+}}(%rsp)
+; CHECK-NEXT: vmovups %ymm7, {{[0-9]+}}(%rsp)
; CHECK-NEXT: vmovups %ymm1, {{[0-9]+}}(%rsp)
; CHECK-NEXT: vmovups %ymm1, {{[0-9]+}}(%rsp)
; CHECK-NEXT: vmovups {{[0-9]+}}(%rsp), %ymm5
Index: llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
===================================================================
--- llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
+++ llvm/lib/CodeGen/CriticalAntiDepBreaker.cpp
@@ -261,15 +261,25 @@
for (unsigned i = 0, e = MI.getNumOperands(); i != e; ++i) {
MachineOperand &MO = MI.getOperand(i);
- if (MO.isRegMask())
- for (unsigned i = 0, e = TRI->getNumRegs(); i != e; ++i)
- if (MO.clobbersPhysReg(i)) {
+ if (MO.isRegMask()) {
+ auto ClobbersPhysRegAndSubRegs = [&](unsigned PhysReg) {
+ for (MCSubRegIterator SRI(PhysReg, TRI, true); SRI.isValid(); ++SRI)
+ if (!MO.clobbersPhysReg(*SRI))
+ return false;
+
+ return true;
+ };
+
+ for (unsigned i = 0, e = TRI->getNumRegs(); i != e; ++i) {
+ if (ClobbersPhysRegAndSubRegs(i)) {
DefIndices[i] = Count;
KillIndices[i] = ~0u;
KeepRegs.reset(i);
Classes[i] = nullptr;
RegRefs.erase(i);
}
+ }
+ }
if (!MO.isReg()) continue;
Register Reg = MO.getReg();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70699.231304.patch
Type: text/x-patch
Size: 2647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191127/858982c4/attachment.bin>
More information about the llvm-commits
mailing list