[PATCH] D144190: [AIX][clang] Storage Locations for Constant Pointers

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 7 22:24:33 PST 2023


hubert.reinterpretcast added a subscriber: w2yehia.
hubert.reinterpretcast added inline comments.


================
Comment at: clang/test/CodeGen/PowerPC/aix-roptr.c:9-10
+// RUN:     -S <%s 2>&1 | FileCheck %s --check-prefix=DATA_SECTION_ERR
+// RUN: not %clang_cc1 -triple=powerpc64le-unknown-linux-gnu -mroptr \
+// RUN:     -S <%s 2>&1 | FileCheck %s --check-prefix=TARGET_ROPTR_ERR
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -mno-roptr \
----------------
Note that a driver test is needed for this sort of case as well.


================
Comment at: clang/test/CodeGen/PowerPC/aix-roptr.c:11-16
+// RUN: not %clang -target powerpc64le-unknown-linux-gnu -mno-roptr \
+// RUN:     -S %s 2>&1 | FileCheck %s --check-prefix=TARGET_NOROPTR_ERR
+// RUN: not %clang -target powerpc-ibm-aix-xcoff -mroptr -shared \
+// RUN:     -S %s 2>&1 | FileCheck %s --check-prefix=SHARED_ERR
+// RUN: not %clang -target powerpc64-ibm-aix-xcoff -mroptr -shared \
+// RUN:     -S %s 2>&1 | FileCheck %s --check-prefix=SHARED_ERR
----------------
These are driver tests. Please move (and use `-###` to avoid accidental reliance on front-end processing).


================
Comment at: clang/test/Driver/ppc-roptr.c:1
+// RUN: %clang -### -target powerpc-ibm-aix-xcoff -mroptr %s 2>&1 | FileCheck %s
+// RUN: %clang -### -target powerpc-ibm-aix-xcoff -mroptr -mno-roptr %s 2>&1 | \
----------------
Should test for `-c` and `-S` as well.
Should test for pure link (without compile) as well.


================
Comment at: clang/test/Driver/ppc-roptr.c:3
+// RUN: %clang -### -target powerpc-ibm-aix-xcoff -mroptr -mno-roptr %s 2>&1 | \
+// RUN: FileCheck %s --check-prefix=ROPTR
+// RUN: %clang -### -target powerpc64-ibm-aix-xcoff -mroptr %s 2>&1 | FileCheck %s
----------------
I think the prefix for this should be named `NO_ROPTR`.


================
Comment at: clang/test/Driver/ppc-roptr.c:10
+// ROPTR-NOT: "-mroptr"
+// ROPTR-NOT: "-bforceimprw"
+
----------------
Do we pass the option through to the LTO codegen when `-fprofile-generate` is used?
We may need a driver diagnostic for `-mroptr` without data sections when linking LTO objects (because the front-end won't be involved).

@w2yehia, does LLVM trunk have a gap in LTO driver enablement for AIX?


================
Comment at: clang/test/Driver/ppc-roptr.c:12-18
+char c1 = 10;
+char c2 = 20;
+char* const c1_ptr = &c1;
+
+int main() {
+    *(char**)&c1_ptr = &c2;
+}
----------------
Why have any code here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144190



More information about the cfe-commits mailing list