Skip to content

Commit ea3a965

Browse files
[X86][NewPM] Cleanup some minor issues in recently ported passes
* Ensure passes implemented as single functions are marked as static to enforce internal linkage. * Avoid the use of temporary variables to hold pass output status that only have one user/do not change any ordering guarantees.
1 parent 1c4e03a commit ea3a965

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

llvm/lib/Target/X86/X86LoadValueInjectionRetHardening.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class X86LoadValueInjectionRetHardeningLegacy : public MachineFunctionPass {
5656

5757
char X86LoadValueInjectionRetHardeningLegacy::ID = 0;
5858

59-
bool runX86LoadValueInjectionRetHardening(MachineFunction &MF) {
59+
static bool runX86LoadValueInjectionRetHardening(MachineFunction &MF) {
6060
const X86Subtarget *Subtarget = &MF.getSubtarget<X86Subtarget>();
6161
if (!Subtarget->useLVIControlFlowIntegrity() || !Subtarget->is64Bit())
6262
return false; // FIXME: support 32-bit
@@ -119,10 +119,10 @@ bool X86LoadValueInjectionRetHardeningLegacy::runOnMachineFunction(
119119

120120
PreservedAnalyses X86LoadValueInjectionRetHardeningPass::run(
121121
MachineFunction &MF, MachineFunctionAnalysisManager &MFAM) {
122-
const bool Modified = runX86LoadValueInjectionRetHardening(MF);
123-
return Modified ? getMachineFunctionPassPreservedAnalyses()
124-
.preserveSet<CFGAnalyses>()
125-
: PreservedAnalyses::all();
122+
return runX86LoadValueInjectionRetHardening(MF)
123+
? getMachineFunctionPassPreservedAnalyses()
124+
.preserveSet<CFGAnalyses>()
125+
: PreservedAnalyses::all();
126126
}
127127

128128
INITIALIZE_PASS(X86LoadValueInjectionRetHardeningLegacy, PASS_KEY,

llvm/lib/Target/X86/X86ReturnThunks.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct X86ReturnThunksLegacy final : public MachineFunctionPass {
5757

5858
char X86ReturnThunksLegacy::ID = 0;
5959

60-
bool runX86ReturnThunks(MachineFunction &MF) {
60+
static bool runX86ReturnThunks(MachineFunction &MF) {
6161
LLVM_DEBUG(dbgs() << X86ReturnThunksPassName << "\n");
6262

6363
bool Modified = false;
@@ -103,10 +103,9 @@ bool X86ReturnThunksLegacy::runOnMachineFunction(MachineFunction &MF) {
103103
PreservedAnalyses
104104
X86ReturnThunksPass::run(MachineFunction &MF,
105105
MachineFunctionAnalysisManager &MFAM) {
106-
const bool Modified = runX86ReturnThunks(MF);
107-
return Modified ? getMachineFunctionPassPreservedAnalyses()
108-
.preserveSet<CFGAnalyses>()
109-
: PreservedAnalyses::all();
106+
return runX86ReturnThunks(MF) ? getMachineFunctionPassPreservedAnalyses()
107+
.preserveSet<CFGAnalyses>()
108+
: PreservedAnalyses::all();
110109
}
111110

112111
INITIALIZE_PASS(X86ReturnThunksLegacy, PASS_KEY, "X86 Return Thunks", false,

llvm/lib/Target/X86/X86SpeculativeExecutionSideEffectSuppression.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ static bool hasConstantAddressingMode(const MachineInstr &MI) {
8787
return true;
8888
}
8989

90-
bool runX86SpeculativeExecutionSideEffectSuppression(MachineFunction &MF) {
90+
static bool
91+
runX86SpeculativeExecutionSideEffectSuppression(MachineFunction &MF) {
9192

9293
const auto &OptLevel = MF.getTarget().getOptLevel();
9394
const X86Subtarget &Subtarget = MF.getSubtarget<X86Subtarget>();

0 commit comments

Comments
 (0)