[PATCH] D110869: [X86] Implement -fzero-call-used-regs option

Nathan Chancellor via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 3 14:28:54 PST 2022


nathanchance added a comment.

In D110869#3295012 <https://reviews.llvm.org/D110869#3295012>, @void wrote:

> In D110869#3294696 <https://reviews.llvm.org/D110869#3294696>, @nathanchance wrote:
>
>> This diff allows me to boot on bare metal as of v5.17-rc2:
>>
>>   diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
>>   index 6aef9ee28a39..8ee176dac669 100644
>>   --- a/arch/x86/kernel/Makefile
>>   +++ b/arch/x86/kernel/Makefile
>>   @@ -125,6 +125,7 @@ obj-$(CONFIG_DEBUG_NMI_SELFTEST) += nmi_selftest.o
>>   
>>    obj-$(CONFIG_KVM_GUEST)                += kvm.o kvmclock.o
>>    obj-$(CONFIG_PARAVIRT)         += paravirt.o
>>   +CFLAGS_paravirt.o += -fzero-call-used-regs=skip
>>    obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= paravirt-spinlocks.o
>>    obj-$(CONFIG_PARAVIRT_CLOCK)   += pvclock.o
>>    obj-$(CONFIG_X86_PMEM_LEGACY_DEVICE) += pmem.o
>>
>> I have uploaded the config used, the preprocessed file, and the "good" object (with the following diff) and the "bad" object (without the above diff) here: https://github.com/nathanchance/bug-files/tree/052a31e6d94c1b349cf6f3128087944444dace24/D110869
>>
>> If there is any more information I can give, please let me know!
>
> Thanks for the information!
>
> Could you test this patch for me? (Applied over the patch in this review.)
>
>   diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
>   index 968a14548813..46ae48bd6a3c 100644
>   --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp
>   +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp
>   @@ -1217,7 +1217,8 @@ void PEI::insertZeroCallUsedRegs(MachineFunction &MF) {
>                continue;
>   
>              MCRegister Reg = MO.getReg();
>   -          if ((MO.isDef() || MO.isUse()) && AllocatableSet[Reg])
>   +          if (AllocatableSet[Reg] && !MO.isImplicit() &&
>   +              (MO.isDef() || MO.isUse()))
>                UsedRegs.set(Reg);
>            }

I tested this patch but it did not change the hang.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110869



More information about the llvm-commits mailing list