[llvm] [AsmPrinter] Fix handling in emitGlobalConstantImpl for AIX (PR #116255)

Hubert Tong via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 14 13:42:08 PST 2024


================
@@ -3858,7 +3860,29 @@ static void emitGlobalConstantImpl(const DataLayout &DL, const Constant *CV,
   if (!BaseCV && CV->hasOneUse())
     BaseCV = dyn_cast<Constant>(CV->user_back());
 
-  if (isa<ConstantAggregateZero>(CV) || isa<UndefValue>(CV))
+  if (isa<ConstantAggregateZero>(CV)) {
+    StructType *structType = llvm::dyn_cast<llvm::StructType>(CV->getType());
+    if (structType && AliasList) {
----------------
hubert-reinterpretcast wrote:

Minor nit: `AliasList` is rarely true; let's make it cheaper for the common case.
```suggestion
    StructType *structType;
    if (AliasList && (structType = llvm::dyn_cast<StructType>(CV->getType()))) {
```

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


More information about the llvm-commits mailing list