================ @@ -2520,7 +2520,9 @@ void PPCAIXAsmPrinter::emitGlobalVariable(const GlobalVariable *GV) { // If the Global Variable has the toc-data attribute, it needs to be emitted // when we emit the .toc section. if (GV->hasAttribute("toc-data")) { - TOCDataGlobalVars.push_back(GV); + unsigned PointerSize = GV->getParent()->getDataLayout().getPointerSize(); ---------------- diggerlin wrote:
if we run `if (G.hasAttribute("toc-data")) (Subtarget->tocDataChecks(G.getParent()->getDataLayout().getPointerSize(), &G));` in the function `PPCAIXAsmPrinter::doInitialization(Module &M)`, we do not need to do `tocDataChecks` in the function `static bool hasTocDataAttr(SDValue Val, unsigned PointerSize, const PPCSubtarget *Subtarget) ` and here The function `hasTocDataAttr` is run for each PPCISD::TOC_ENTRY node, if a toc variable is referenced several time by the `PPCISD::TOC_ENTRY` in user application the function `tocDataChecks` will be called several times for the same variable and the `tocDataCheck` is not a small function. https://github.com/llvm/llvm-project/pull/67999 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits