[PATCH] D78471: [x86/SLH] Pin function address in physical register after it been hardened.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 12 19:57:00 PDT 2020


craig.topper added a comment.

In D78471#2033001 <https://reviews.llvm.org/D78471#2033001>, @pengfei wrote:

> In D78471#2032415 <https://reviews.llvm.org/D78471#2032415>, @craig.topper wrote:
>
> > Is the problem here really that foldMemoryOperand doesn't know to preserve the post instr symbol?
>
>
> Yes and no. It's the problem I wanted to fix firstly. But after I read the code of hardening, I think the spill is also a problem. Because that pass always load the function address to register at the beginning. I think the spilling violates the objective the pass does. Beside, according to calling conversation, there are volatile registers before calling. So I think it's not a cost if we pin the address register.


I think we should be calling NewMI->cloneInstrSymbols  in the same spot we copy memory references in TargetInstrInfo::foldMemoryOperand. Or we shouldn't disable folding if any symbols are present. We're effectively cloning an instruction when we fold the memory and we should make sure we don't drop things when we do that.

Whether SLH should spill or not is something we can still address, but that's a detail of what the right thing to do for SLH is. I view it separately from incorrectly cloning the instruction in folding.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78471/new/

https://reviews.llvm.org/D78471





More information about the llvm-commits mailing list