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

2022-09-16 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Follow up fix: https://reviews.llvm.org/D133946 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 ___ cfe-commits mailing list

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

2022-02-11 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3315135 , @xbolva00 wrote: > @void It would be cool to mention this new feature in release notes. Good idea! https://reviews.llvm.org/D119592 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

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

2022-02-11 Thread Dávid Bolvanský via Phabricator via cfe-commits
xbolva00 added a comment. @void It would be cool to mention this new feature in release notes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 ___ cfe-commits

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

2022-02-11 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3313443 , @void wrote: > In D110869#3312360 , @RKSimon wrote: > >> @void This buildbot appears to be still broken due to this change: >>

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

2022-02-10 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3312360 , @RKSimon wrote: > @void This buildbot appears to be still broken due to this change: > https://lab.llvm.org/buildbot/#/builders/110/builds/10271 Strange...This is the first time seeing something like this.

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

2022-02-10 Thread Simon Pilgrim via Phabricator via cfe-commits
RKSimon added a comment. @void This buildbot appears to be still broken due to this change: https://lab.llvm.org/buildbot/#/builders/110/builds/10271 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869

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

2022-02-09 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3307106 , @nikic wrote: > It looks like this breaks expensive checks builds due to machine verifier > errors: https://lab.llvm.org/buildbot/#/builders/16/builds/24103 Sorry about that. Looking into it now. Repository:

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

2022-02-09 Thread Nikita Popov via Phabricator via cfe-commits
nikic added a comment. It looks like this breaks expensive checks builds due to machine verifier errors: https://lab.llvm.org/buildbot/#/builders/16/builds/24103 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/

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

2022-02-08 Thread Bill Wendling via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rGdeaf22bc0e30: [X86] Implement -fzero-call-used-regs option (authored by void). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

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

2022-02-08 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 406948. void added a comment. Remove obsolete change. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files: clang/include/clang/Basic/Attr.td

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

2022-02-08 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 406924. void added a comment. Move register clearning to after the "pop"s. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files: clang/include/clang/Basic/Attr.td

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

2022-02-08 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:595 +continue; + XorOp = X86::PXORrr; +} else if (X86::VR256RegClass.contains(Reg)) { nickdesaulniers wrote: > void wrote: > > nickdesaulniers wrote: > > > Is there

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

2022-02-08 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:595 +continue; + XorOp = X86::PXORrr; +} else if (X86::VR256RegClass.contains(Reg)) { void wrote: > nickdesaulniers wrote: > > Is there any way to figure

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

2022-02-08 Thread Kees Cook via Phabricator via cfe-commits
kees added a comment. I can build and boot with this. Nice! :) One issue I see is in instruction sequence ordering. Looking at the end of `__startup_64` without the feature enabled, everything looks "normal": 31 c0 xor%eax,%eax 5b pop%rbx 41 5e pop%r14 41

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

2022-02-07 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei added a comment. > So xorl %ecx, %edx doesn't zero out all 64-bits of %rcx and %rdx? That's two > 32-bit writes to two different registers, isn't it? `xorl %ecx, %edx` only zero out bit 63:32 of `rdx`. 1. There's only 1 write to register in the instruction, i.e. `%edx`; 2. As a src,

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

2022-02-07 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. In D110869#3302625 , @nickdesaulniers wrote: > All built+boot. I know @nathanchance pointed out an issue with some already > complex code, but I'm of the opinion that fn should be attributed in kernel > sources. Aside

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

2022-02-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: llvm/test/CodeGen/X86/zero-call-used-regs.ll:287 +entry: + store volatile i32 2, i32* @result, align 4 + ret i32 0 void wrote: > nickdesaulniers wrote: > > necessary? > It's main. Of course it's necessary. :-)

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

2022-02-07 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3296047 , @craig.topper wrote: > In D110869#3296031 , @void wrote: > >> In D110869#3295912 , @craig.topper >> wrote: >> >>> In

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

2022-02-07 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 406646. void marked 4 inline comments as done. void added a comment. General updates NFC.. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-02-07 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers accepted this revision. nickdesaulniers added a comment. This revision is now accepted and ready to land. I tested the following linux-next configs with CONFIG_ZERO_CALL_USED_REGS enabled: - x86_64 defconfig - x86_64 defconfig + thin LTO - x86_64 defconfig + full LTO - i386

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

2022-02-07 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 406596. void marked an inline comment as done. void added a comment. Better define what we mean by "call-used". Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-02-04 Thread James Y Knight via Phabricator via cfe-commits
jyknight added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:6271 +This attribute, when attached to a function, causes the compiler to zero a +subset of all call-used registers before the function returns. It's used to +increase program security by either

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

2022-02-04 Thread James Y Knight via Phabricator via cfe-commits
jyknight added a comment. In D110869#3295477 , @nathanchance wrote: > Rather interesting function to have problems with as a result of this patch > but it seems like this function is being used in a very specific way further > down the file with the

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

2022-02-04 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 405897. void added a comment. Only need to zero out 32-bit registers with xor. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-02-04 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment. In D110869#3296031 , @void wrote: > In D110869#3295912 , @craig.topper > wrote: > >> In D110869#3295906 , @void wrote: >> >>> In

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

2022-02-04 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3295912 , @craig.topper wrote: > In D110869#3295906 , @void wrote: > >> In D110869#3295578 , >> @nickdesaulniers wrote: >> >>> In

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

2022-02-03 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added a comment. In D110869#3295906 , @void wrote: > In D110869#3295578 , > @nickdesaulniers wrote: > >> In D110869#3295559 , @void wrote: >> >>> Weird. We

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

2022-02-03 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3295578 , @nickdesaulniers wrote: > In D110869#3295559 , @void wrote: > >> Weird. We generate similar code to GCC: >> >> Clang: >> _paravirt_ident_64: #

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

2022-02-03 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. In D110869#3295559 , @void wrote: > Weird. We generate similar code to GCC: > > Clang: > _paravirt_ident_64: # @_paravirt_ident_64 > movq%rdi, %rax > xorq%rdi, %rdi >

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

2022-02-03 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3295477 , @nathanchance wrote: > It looks like `_paravirt_ident_64()` is the problematic function. This diff > on top of v5.17-rc2 allows me to boot: > > diff --git a/arch/x86/kernel/paravirt.c

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

2022-02-03 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. It looks like `_paravirt_ident_64()` is the problematic function. This diff on top of v5.17-rc2 allows me to boot: diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 4420499f7bb4..c1b68504136c 100644 --- a/arch/x86/kernel/paravirt.c

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

2022-02-03 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3295147 , @nathanchance wrote: > > I tested this patch but it did not change the hang. Okay. We need to determine which function is failing. Could you do something like this: #define zcur

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

2022-02-03 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. In D110869#3295012 , @void wrote: > In D110869#3294696 , @nathanchance > wrote: > >> This diff allows me to boot on bare metal as of v5.17-rc2: >> >> diff --git

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

2022-02-03 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In 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 > ---

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

2022-02-03 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. 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 @@

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

2022-02-03 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. The latest revision allows me to boot a kernel in QEMU now but that same kernel does not boot on bare metal. I'll see if I can narrow down the problematic translation unit with Nick's `subdir-ccflags-y` trick. Repository: rG LLVM Github Monorepo CHANGES SINCE

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

2022-02-02 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3289073 , @nickdesaulniers wrote: > Diff 405119 still kernel panics for me. This is building the linux-next tree. > > $ qemu-system-x86_64 --version > QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-1) Works now.

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

2022-02-02 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 405531. void added a comment. Make sure we're zeroing the registers in the return block, not just some random block. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869

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

2022-02-02 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3289073 , @nickdesaulniers wrote: > Diff 405119 still kernel panics for me. This is building the linux-next tree. > > $ qemu-system-x86_64 --version > QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-1) Okay. I can

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

2022-02-01 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 405137. void added a comment. Remove dead assign. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files: clang/include/clang/Basic/Attr.td

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

2022-02-01 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Diff 405119 still kernel panics for me. This is building the linux-next tree. $ qemu-system-x86_64 --version QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-1) Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:516 + } + return MBBI =

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

2022-02-01 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3288485 , @nickdesaulniers wrote: > Hey! Looks like Diff 404763 for an x86 defconfig plus > CONFIG_ZERO_CALL_USED_REGS=y starts booting! Looks like it panics though > trying to launch `init`(pid 1) though. > > [

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

2022-02-01 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1269 + const TargetFrameLowering = *MF.getSubtarget().getFrameLowering(); + for (auto RestoreBlock : RestoreBlocks) +TFI.emitZeroCallUsedRegs(RegsToZero, *RestoreBlock);

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

2022-02-01 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 405119. void marked 5 inline comments as done. void added a comment. Remove debugging instruction. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-02-01 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 405117. void added a comment. - Don't use "llvm::for_each" or "auto" as much. - Don't zero out registers that are restored before exit. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/

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

2022-02-01 Thread Matt Arsenault via Phabricator via cfe-commits
arsenm added inline comments. Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1259 + +for (const MCPhysReg : + TRI.sub_and_superregs_inclusive(MO.getReg())) No reference Comment at:

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

2022-02-01 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1269 + const TargetFrameLowering = *MF.getSubtarget().getFrameLowering(); + for (auto RestoreBlock : RestoreBlocks) +TFI.emitZeroCallUsedRegs(RegsToZero, *RestoreBlock);

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

2022-02-01 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Hey! Looks like Diff 404763 for an x86 defconfig plus CONFIG_ZERO_CALL_USED_REGS=y starts booting! Looks like it panics though trying to launch `init`(pid 1) though. [0.702163] Run /bin/sh as init process [0.702913] Failed to execute /bin/sh (error

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

2022-01-31 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: llvm/test/CodeGen/X86/zero-call-used-regs-fmod.ll:15 +; CHECK-NEXT:xorps %xmm1, %xmm1 +; CHECK-NEXT:popq %rax +; CHECK-NEXT:.cfi_def_cfa_offset 8 void wrote: > craig.topper wrote: > > Is it ok that this

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

2022-01-31 Thread Bill Wendling via Phabricator via cfe-commits
void marked 3 inline comments as done. void added inline comments. Comment at: llvm/include/llvm/CodeGen/MachineRegisterInfo.h:232-240 + /// Returns true if a register can be used as an argument to a function. + bool isArgumentRegister(const MachineFunction , MCRegister Reg)

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

2022-01-31 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 404763. void added a comment. Remove attribute from "main" function. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files: clang/include/clang/Basic/Attr.td

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

2022-01-31 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 404761. void added a comment. Remove "zero-call-used-regs" attribute in front-end if it's "main". Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-01-31 Thread Bill Wendling via Phabricator via cfe-commits
void marked 2 inline comments as done. void added inline comments. Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1182 + + if (!F.hasFnAttribute("zero-call-used-regs") || + // No need to zero call regs in main(). craig.topper wrote: > Should the

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

2022-01-31 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: llvm/lib/Target/X86/X86RegisterInfo.cpp:621 +BitVector X86RegisterInfo::getArgumentRegs(const MachineFunction ) const { + const X86Subtarget = MF.getSubtarget(); nickdesaulniers wrote: > pengfei wrote: > >

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

2022-01-31 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added a comment. Neat use of tablegen; will take me a bit to wrap my head around it. I'll give this a shot on some kernel builds first thing tomorrow! Comment at: llvm/include/llvm/CodeGen/MachineRegisterInfo.h:232-240 + /// Returns true if a register can be

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

2022-01-31 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: llvm/lib/CodeGen/PrologEpilogInserter.cpp:1182 + + if (!F.hasFnAttribute("zero-call-used-regs") || + // No need to zero call regs in main(). Should the frontend avoid putting the attribute on "main" instead

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

2022-01-31 Thread Craig Topper via Phabricator via cfe-commits
craig.topper added inline comments. Comment at: llvm/lib/Target/X86/X86RegisterInfo.td:647 +def GeneralPurposeRegisters : RegisterCategory<[GR64, GR32, GR16, GR8]>; +def FixedRegisters : RegisterCategory<[DEBUG_REG, CONTROL_REG, CCR, FPCCR, +

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

2022-01-31 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 404754. void added a comment. Generate the "isGeneralPurposeRegister" and "isFixedRegister" predicates from the .td file. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869

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

2022-01-29 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 404336. void added a comment. Make this only for x86. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files: clang/include/clang/Basic/Attr.td

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

2022-01-29 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 404326. void added a comment. Don't zero out all sub and super registers that are callee-saved. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-01-28 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. Hey, y'all! I've finished the initial part of this feature. I compiled a Linux kernel with it, and it booted via qemu. Please give it a go and let me know what you think. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

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

2022-01-28 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 404236. void added a comment. Move the zeroing of registers to before the pop instructions. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-01-28 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 403906. void added a comment. WIP: Modify the zeroing of GPRs to be less gross. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2022-01-27 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 403815. void added a comment. WIP: Updated to make selecing registers to zero out more generic. Combined a few tests into one, and made the logic emitting the "xors" a bit nicer. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

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

2021-11-25 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 389922. void added a comment. WIP: Implement zeroing out registers. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files: clang/include/clang/Basic/Attr.td

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

2021-11-23 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 389101. void added a comment. WIP: Move register selection to a platform-generic place. Not ready for review just yet. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869

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

2021-10-26 Thread Phoebe Wang via Phabricator via cfe-commits
pengfei added inline comments. Comment at: llvm/lib/Target/X86/X86FrameLowering.cpp:540 + if (STI.hasSSE1()) +AddRegs(CallUsedRegs, X86::VR128RegClass); + if (STI.hasAVX()) Do we need to consider VR128XRegClass and VR256XRegClass when `hasVLX()`?

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

2021-10-26 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3087776 , @nathanchance wrote: > `check-llvm` does not pass with this revision nor does it resolve the boot > failure that Nick mentioned, just in case that was the intention of the > revision :) I ran the kernel

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

2021-10-26 Thread Nathan Chancellor via Phabricator via cfe-commits
nathanchance added a comment. `check-llvm` does not pass with this revision nor does it resolve the boot failure that Nick mentioned, just in case that was the intention of the revision :) I ran the kernel through `gdb` and it still does not appear to get to `start_kernel`. Repository: rG

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

2021-10-25 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 382155. void added a comment. Count sub/super registers as "uses" in terminating instructions. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2021-10-25 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. In D110869#3034616 , @nickdesaulniers wrote: > We'll probably need to investigate code gen a little. > > A mainline linux kernel defconfig built with `CONFIG_ZERO_CALL_USED_REGS=y` > enabled doesn't boot, for example. I consider

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

2021-09-30 Thread Bill Wendling via Phabricator via cfe-commits
void added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:6116 + +- ``skip`` doesn't zero any call-used registers. +- ``used`` only zeros call-used registers used in the function. By ``used``, we void wrote: > nickdesaulniers wrote: > > Might

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

2021-09-30 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. Hmm...not working on Linux sounds bad. I'll investigate. Comment at: clang/include/clang/Basic/AttrDocs.td:6116 + +- ``skip`` doesn't zero any call-used registers. +- ``used`` only zeros call-used registers used in the function. By ``used``, we

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

2021-09-30 Thread Bill Wendling via Phabricator via cfe-commits
void updated this revision to Diff 376386. void marked 3 inline comments as done. void added a comment. Fixed some spelling and variable names. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869 Files:

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

2021-09-30 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers requested changes to this revision. nickdesaulniers added a comment. This revision now requires changes to proceed. We'll probably need to investigate code gen a little. A mainline linux kernel defconfig built with `CONFIG_ZERO_CALL_USED_REGS=y` enabled doesn't boot, for

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

2021-09-30 Thread Nick Desaulniers via Phabricator via cfe-commits
nickdesaulniers added inline comments. Comment at: clang/include/clang/Basic/AttrDocs.td:6108 + let Content = [{ +This attribute, when attached to a funcditon, causes the compiler to zero a +subset of all call-used registers before the function returns. It's used to

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

2021-09-30 Thread Bill Wendling via Phabricator via cfe-commits
void added a comment. The way I select the registers to zero out seems rather fragile. Is there a nicer way to do this? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D110869/new/ https://reviews.llvm.org/D110869

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

2021-09-30 Thread Bill Wendling via Phabricator via cfe-commits
void created this revision. void added reviewers: kees, nickdesaulniers, jyknight. Herald added subscribers: dexonsmith, dang, jdoerfert, pengfei, hiraditya. Herald added a reviewer: aaron.ballman. void requested review of this revision. Herald added projects: clang, LLVM. Herald added