[PATCH] D124654: [AIX] Handling the label alignment of a global variable with its multiple aliases.

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 02:57:18 PDT 2022


shchenz added inline comments.


================
Comment at: llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp:3262
   if (const ConstantArray *CVA = dyn_cast<ConstantArray>(CV))
-    return emitGlobalConstantArray(DL, CVA, AP, BaseCV, Offset);
+    return emitGlobalConstantArray(DL, CVA, AP, BaseCV, Offset, AliasList);
 
----------------
No idea why my comments here is lost in my last post. I will re-post it.

I tested some array and vector cases, I think current patch may not be able to handle them well on AIX. Could you please verify? As you are also handling array here, so do we plan to fix them all? Or we just want to fix `ConstantStruct` type?

case 1: vector type, `ConstantDataSequential`
```
@_MergedGlobals = global <2 x i64> <i64 12, i64 34>, align 4
@var1 = alias i64, getelementptr inbounds (<2 x i64>, <2 x i64>* @_MergedGlobals, i32 0, i32 1)

define void @foo(i64 %a1) {
  store i64 %a1, i64* getelementptr inbounds (<2 x i64>, <2 x i64>* @_MergedGlobals, i32 0, i32 1), align 4
  ret void
}
```

case 2: array type, `ConstantDataSequential`:
```
@_MergedGlobals = global [2 x i64] [i64 12, i64 34], align 4
@var1 = alias i64, getelementptr inbounds ([2 x i64], [2 x i64]* @_MergedGlobals, i32 0, i32 1)

define void @foo(i64 %a1) {
  store i64 %a1, i64* getelementptr inbounds ([2 x i64], [2 x i64]* @_MergedGlobals, i32 0, i32 1), align 4
  ret void
}
```

case 3: array type, `ConstantArray`:
```
%struct.B = type { i64 }
@_MergedGlobals = global [2 x %struct.B] [%struct.B {i64 12}, %struct.B {i64 34}], align 4
@var1 = alias %struct.B, getelementptr inbounds ([2 x %struct.B], [2 x %struct.B]* @_MergedGlobals, i32 0, i32 0)

define void @foo(%struct.B %a1) {
  store %struct.B %a1, %struct.B* getelementptr inbounds ([2 x %struct.B], [2 x %struct.B]* @_MergedGlobals, i32 0, i32 1), align 4
  ret void
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D124654/new/

https://reviews.llvm.org/D124654



More information about the llvm-commits mailing list