[PATCH] D71551: [AIX][XCOFF]Implement mergeable const

Jason Liu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 16 15:27:55 PST 2019


jasonliu added inline comments.


================
Comment at: llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp:1891
+
+  if (Kind.isReadOnly())
     return ReadOnlySection;
----------------
hubert.reinterpretcast wrote:
> If we believe that there should be special mergeable const sections, then we should assert here that we have handled all mergeable const section variants (in case additional ones are added in the future).
Questions regarding the design
1. Do we really need special mergeable const section on AIX? What's the advantage of that? What's wrong if we just dump all of them to ReadOnlySection? 

2. 
For the same C source
```
typedef struct {
 unsigned short id;
 unsigned char  options;
} Merge_cnst4;

int main() {
 Merge_cnst4 const cnst4  = { .id = 123};
}
```
Looks like GCC and xlc are able to just store the data member directly without making csects, which is more efficient. I guess clang's FE could generate better IR later to match that?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71551





More information about the llvm-commits mailing list