github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,c,h --
clang/test/CodeGen/SystemZ/stack-guard-pseudos.c
clang/lib/CodeGen/CodeGenFunction.cpp clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/stack-protector-guard.c
llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
llvm/lib/Target/SystemZ/SystemZAsmPrinter.h
llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
llvm/lib/Target/SystemZ/SystemZISelLowering.h
llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
llvm/lib/Target/SystemZ/SystemZInstrInfo.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
index 74d2ab68c..13b7273f2 100644
--- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp
@@ -744,15 +744,17 @@ void SystemZAsmPrinter::emitInstruction(const
MachineInstr *MI) {
return;
case SystemZ::LOAD_STACK_GUARD:
- llvm_unreachable("LOAD_STACK_GUARD should have been eliminated by the DAG
Combiner.");
+ llvm_unreachable(
+ "LOAD_STACK_GUARD should have been eliminated by the DAG Combiner.");
case SystemZ::MOVE_STACK_GUARD:
case SystemZ::COMPARE_STACK_GUARD:
- llvm_unreachable("MOVE_STACK_GUARD and COMPARE_STACK_GUARD should have
been expanded by ExpandPostRAPseudo.");
+ llvm_unreachable("MOVE_STACK_GUARD and COMPARE_STACK_GUARD should have "
+ "been expanded by ExpandPostRAPseudo.");
case SystemZ::LARL:
case SystemZ::LGRL: {
- auto & Op = MI->getOperand(1);
+ auto &Op = MI->getOperand(1);
if (Op.isGlobal() && (Op.getGlobal()->getName() == "__stack_chk_guard"))
emitStackProtectorLocEntry();
Lower.lower(MI, LoweredMI);
@@ -776,7 +778,6 @@ void SystemZAsmPrinter::emitStackProtectorLocEntry() {
OutStreamer->emitLabel(Sym);
}
-
// Emit the largest nop instruction smaller than or equal to NumBytes
// bytes. Return the size of nop emitted.
static unsigned EmitNop(MCContext &OutContext, MCStreamer &OutStreamer,
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
index acc9a68f1..2893cdc7e 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
@@ -1791,27 +1791,27 @@ bool SystemZInstrInfo::expandPostRAPseudo(MachineInstr
&MI) const {
}
namespace {
- Register scavengeAddrReg(MachineInstr& MI, MachineBasicBlock* MBB) {
- // create fresh RegScavanger instance.
- RegScavenger RS;
- // initialize RegScavenger to correct location
- RS.enterBasicBlockEnd(*MBB);
- RS.backward(MI);
-
- // Attempt to find a free register.
- Register Scratch = RS.FindUnusedReg(&SystemZ::ADDR64BitRegClass);
- // If not found, scavenge one, i.e. evict something to a stack spill slot.
- if (!Scratch) {
- Scratch = RS.scavengeRegisterBackwards(
- SystemZ::ADDR64BitRegClass,
- MI, // Scavenge back to this position.
- true, // Will need Scratch Reg after MI.
- 0,
- true // Spills are allowed.
- );
- }
- return Scratch;
- }
+Register scavengeAddrReg(MachineInstr &MI, MachineBasicBlock *MBB) {
+ // create fresh RegScavanger instance.
+ RegScavenger RS;
+ // initialize RegScavenger to correct location
+ RS.enterBasicBlockEnd(*MBB);
+ RS.backward(MI);
+
+ // Attempt to find a free register.
+ Register Scratch = RS.FindUnusedReg(&SystemZ::ADDR64BitRegClass);
+ // If not found, scavenge one, i.e. evict something to a stack spill slot.
+ if (!Scratch) {
+ Scratch =
+ RS.scavengeRegisterBackwards(SystemZ::ADDR64BitRegClass,
+ MI, // Scavenge back to this position.
+ true, // Will need Scratch Reg after MI.
+ 0,
+ true // Spills are allowed.
+ );
+ }
+ return Scratch;
+}
unsigned long getStackGuardOffset(const MachineBasicBlock *MBB) {
// In the TLS (default) case, AddrReg will contain the thread pointer, so we
// need to add 40 bytes to get the actual address of the stack guard.
@@ -1824,7 +1824,7 @@ unsigned long getStackGuardOffset(const MachineBasicBlock
*MBB) {
// return that register. If not, scavenge a new register and return that.
// This is a workaround for https://github.com/llvm/llvm-project/issues/172511
// and should be removed once that issue is resolved.
-Register chooseAddrReg(MachineInstr& MI, MachineBasicBlock *MBB) {
+Register chooseAddrReg(MachineInstr &MI, MachineBasicBlock *MBB) {
Register DefReg = MI.getOperand(0).getReg();
Register OpReg = MI.getOperand(1).getReg();
// if we can use DefReg, return it
@@ -1837,7 +1837,8 @@ Register chooseAddrReg(MachineInstr& MI,
MachineBasicBlock *MBB) {
// Emit the stack guard address load, depending on guard type.
// Return the register the stack guard address was loaded into.
-void SystemZInstrInfo::emitLoadStackGuardAddress(MachineInstr &MI, Register
AddrReg) const {
+void SystemZInstrInfo::emitLoadStackGuardAddress(MachineInstr &MI,
+ Register AddrReg) const {
MachineBasicBlock &MBB = *(MI.getParent());
const MachineFunction &MF = *(MBB.getParent());
const MachineRegisterInfo &MRI = MF.getRegInfo();
@@ -1853,8 +1854,7 @@ void
SystemZInstrInfo::emitLoadStackGuardAddress(MachineInstr &MI, Register Addr
// the GR containing %a0 and %a1.
// ear <reg>, %a0
- BuildMI(MBB, MI, DL, get(SystemZ::EAR), Reg32)
- .addReg(SystemZ::A0);
+ BuildMI(MBB, MI, DL, get(SystemZ::EAR), Reg32).addReg(SystemZ::A0);
// sllg <reg>, <reg>, 32
BuildMI(MBB, MI, DL, get(SystemZ::SLLG), AddrReg)
@@ -1863,8 +1863,7 @@ void
SystemZInstrInfo::emitLoadStackGuardAddress(MachineInstr &MI, Register Addr
.addImm(32);
// ear <reg>, %a1
- BuildMI(MBB, MI, DL, get(SystemZ::EAR), Reg32)
- .addReg(SystemZ::A1);
+ BuildMI(MBB, MI, DL, get(SystemZ::EAR), Reg32).addReg(SystemZ::A1);
} else if (GuardType == "global") {
// Obtain the global value.
@@ -1889,7 +1888,7 @@ void
SystemZInstrInfo::emitLoadStackGuardAddress(MachineInstr &MI, Register Addr
}
void SystemZInstrInfo::expandMSGPseudo(MachineInstr &MI) const {
- MachineBasicBlock* MBB = MI.getParent();
+ MachineBasicBlock *MBB = MI.getParent();
Register AddrReg = chooseAddrReg(MI, MBB);
emitLoadStackGuardAddress(MI, AddrReg);
BuildMI(*(MI.getParent()), MI, MI.getDebugLoc(), get(SystemZ::MVC))
@@ -1901,7 +1900,7 @@ void SystemZInstrInfo::expandMSGPseudo(MachineInstr &MI)
const {
MI.removeFromParent();
}
void SystemZInstrInfo::expandCSGPseudo(MachineInstr &MI) const {
- MachineBasicBlock* MBB = MI.getParent();
+ MachineBasicBlock *MBB = MI.getParent();
Register AddrReg = chooseAddrReg(MI, MBB);
emitLoadStackGuardAddress(MI, AddrReg);
BuildMI(*(MI.getParent()), MI, MI.getDebugLoc(), get(SystemZ::CLC))
@@ -1931,23 +1930,23 @@ unsigned SystemZInstrInfo::getInstSizeInBytes(const
MachineInstr &MI) const {
return 18 + (MI.getOperand(0).getImm() == SystemZ::CondReturn ? 4 : 0);
if ((MI.getOpcode() == SystemZ::MOVE_STACK_GUARD) ||
(MI.getOpcode() == SystemZ::COMPARE_STACK_GUARD)) {
- StringRef GuardType = MI.getParent()
- ->getParent()
- ->getFunction()
- .getParent()
- ->getStackProtectorGuard();
- unsigned Size = 6; // mvc,clc
- if (GuardType == "global")
- Size += 6; // larl/lgrl
- else if (GuardType.empty() || GuardType == "tls")
- Size += 14; // ear,sllg,ear
- else
- llvm_unreachable(
+ StringRef GuardType = MI.getParent()
+ ->getParent()
+ ->getFunction()
+ .getParent()
+ ->getStackProtectorGuard();
+ unsigned Size = 6; // mvc,clc
+ if (GuardType == "global")
+ Size += 6; // larl/lgrl
+ else if (GuardType.empty() || GuardType == "tls")
+ Size += 14; // ear,sllg,ear
+ else
+ llvm_unreachable(
(Twine("Unknown stack protector type \"") + GuardType + "\"")
- .str()
- .c_str());
- return Size;
- }
+ .str()
+ .c_str());
+ return Size;
+ }
return MI.getDesc().getSize();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/169317
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits