Skip to content

Commit aaa37d6

Browse files
authored
[PPC] Replace PPCMergeStringPool with GlobalMerge for Linux (#114850)
Enable merging all constants without looking at use in GlobalMerge by default to replace PPCMergeStringPool pass on Linux.
1 parent c284326 commit aaa37d6

20 files changed

+339
-845
lines changed

llvm/lib/CodeGen/GlobalMerge.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#include "llvm/IR/GlobalValue.h"
8080
#include "llvm/IR/GlobalVariable.h"
8181
#include "llvm/IR/Instruction.h"
82+
#include "llvm/IR/IntrinsicInst.h"
8283
#include "llvm/IR/Module.h"
8384
#include "llvm/IR/Type.h"
8485
#include "llvm/IR/Use.h"
@@ -632,10 +633,13 @@ void GlobalMergeImpl::setMustKeepGlobalVariables(Module &M) {
632633
for (Function &F : M) {
633634
for (BasicBlock &BB : F) {
634635
Instruction *Pad = BB.getFirstNonPHI();
635-
if (!Pad->isEHPad())
636+
auto *II = dyn_cast<IntrinsicInst>(Pad);
637+
if (!Pad->isEHPad() &&
638+
!(II && II->getIntrinsicID() == Intrinsic::eh_typeid_for))
636639
continue;
637640

638-
// Keep globals used by landingpads and catchpads.
641+
// Keep globals used by landingpads, catchpads,
642+
// or intrinsics that require a plain global.
639643
for (const Use &U : Pad->operands()) {
640644
if (const GlobalVariable *GV =
641645
dyn_cast<GlobalVariable>(U->stripPointerCasts()))

llvm/lib/Target/PowerPC/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ add_llvm_target(PowerPCCodeGen
4141
PPCMachineFunctionInfo.cpp
4242
PPCMachineScheduler.cpp
4343
PPCMacroFusion.cpp
44-
PPCMergeStringPool.cpp
4544
PPCMIPeephole.cpp
4645
PPCRegisterInfo.cpp
4746
PPCSubtarget.cpp

llvm/lib/Target/PowerPC/PPC.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ class ModulePass;
5353
FunctionPass *createPPCPreEmitPeepholePass();
5454
FunctionPass *createPPCExpandAtomicPseudoPass();
5555
FunctionPass *createPPCCTRLoopsPass();
56-
ModulePass *createPPCMergeStringPoolPass();
5756
void LowerPPCMachineInstrToMCInst(const MachineInstr *MI, MCInst &OutMI,
5857
AsmPrinter &AP);
5958
bool LowerPPCMachineOperandToMCOperand(const MachineOperand &MO,
@@ -79,7 +78,6 @@ class ModulePass;
7978
void initializePPCExpandAtomicPseudoPass(PassRegistry &);
8079
void initializePPCCTRLoopsPass(PassRegistry &);
8180
void initializePPCDAGToDAGISelLegacyPass(PassRegistry &);
82-
void initializePPCMergeStringPoolPass(PassRegistry &);
8381

8482
extern char &PPCVSXFMAMutateID;
8583

llvm/lib/Target/PowerPC/PPCMergeStringPool.cpp

Lines changed: 0 additions & 334 deletions
This file was deleted.

0 commit comments

Comments
 (0)