[PATCH] D134282: [CGP] Add generic TargetLowering::shouldAlignPointerArgs() implementation
David Tenty via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 23 10:01:41 PST 2023
daltenty added a comment.
Here's an IR only example which will exhibit the invalid AIX assembly after this change:
target datalayout = "E-m:a-i64:64-n32:64-S128-v256:256:256-v512:512:512"
target triple = "powerpc64-ibm-aix"
@.str = private unnamed_addr constant [14 x i8] c"error message\00"
define internal fastcc void @_ZN12_GLOBAL__N_12anIPKclPcEET1_T_T0_S4_() {
entry:
store i64 0, ptr @.str, align 8
unreachable
}
define internal fastcc void @_ZN12_GLOBAL__N_12alIPKcPcEEvT_S4_T0_(i64 %0) {
entry:
tail call void @llvm.memcpy.p0.p0.i64(ptr null, ptr @.str, i64 %0, i1 false)
ret void
}
; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
We see the same TOC reference without a def:
.csect .rodata.str1.8L...str[RO],2
.tc .rodata.str1.1L...str[TC],.rodata.str1.1L...str[RO]
.tc .rodata.str1.8L...str[TC],.rodata.str1.8L...str[RO]
The problem seems to lie in the fact that we codegen the first function with no explicit alignment for `@.str` resulting in TOC references to the `.rodata.str1.1L` section , but after this change when doing CodeGenPrepare we modify the alignment on `@.str` to 8, which changes the MCSection (i.e. csect) name for the final object we emit.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D134282/new/
https://reviews.llvm.org/D134282
More information about the llvm-commits
mailing list