[PATCH] D39173: [MachineCSE] Remove redudant TLS access instructions.

Hal Finkel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 23 12:49:04 PDT 2017


hfinkel added inline comments.


================
Comment at: lib/CodeGen/MachineCSE.cpp:255
+    if (!MRI->isConstantPhysReg(Reg) &&
+        !(TRI->isCallerPreservedPhysReg(Reg, *MI->getParent()->getParent())))
       for (MCRegAliasIterator AI(Reg, TRI, true); AI.isValid(); ++AI)
----------------
kbarton wrote:
> Is it not possible to put this check into isConstantPhysReg instead? 
> 
No, I don't think so. We don't track register dependencies at all (e.g., during instruction scheduling) for constant phys regs. We can't add r2 to that constant set (because we need scheduling to understand the constraints on the r2 save/restore code).

isCallerPreservedPhysReg can only be used if we know that we're not dealing with transformations that can disturb the save/restore sequences. Is this generally safe here?


https://reviews.llvm.org/D39173





More information about the llvm-commits mailing list