[llvm] [PowerPC][AIX] 64-bit large code-model support for toc-data (PR #90619)

Zaara Syeda via llvm-commits llvm-commits at lists.llvm.org
Thu May 2 10:51:39 PDT 2024


================
@@ -1148,21 +1148,21 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
 
     MCSymbolRefExpr::VariantKind VK = GetVKForMO(MO);
 
-    // If the symbol isn't toc-data then use the TOC on AIX.
+    // If the symbol does not have the toc-data attribute, then we create the
+    // TOC entry on AIX. If the toc-data attribute is used, the TOC entry
+    // contains the data rather than the address of the MOSymbol.
     // Map the global address operand to be a reference to the TOC entry we
     // will synthesize later. 'TOCEntry' is a label used to reference the
     // storage allocated in the TOC which contains the address of 'MOSymbol'.
-    // If the toc-data attribute is used, the TOC entry contains the data
-    // rather than the address of the MOSymbol.
     if (![](const MachineOperand &MO) {
           if (!MO.isGlobal())
             return false;
 
-          const GlobalVariable *GV = dyn_cast<GlobalVariable>(MO.getGlobal());
-          if (!GV)
-            return false;
+          if (const GlobalVariable *GV =
+                  dyn_cast<GlobalVariable>(MO.getGlobal()))
+            return GV->hasAttribute("toc-data");
 
-          return GV->hasAttribute("toc-data");
+          return false;
----------------
syzaara wrote:

Yes.

https://github.com/llvm/llvm-project/pull/90619


More information about the llvm-commits mailing list