ZarkoCA created this revision. ZarkoCA added reviewers: sfertile, cebowleratibm. ZarkoCA added a project: PowerPC. Herald added subscribers: shchenz, nemanjai. Herald added a reviewer: aaron.ballman. ZarkoCA requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
https://reviews.llvm.org/D105659 implements ByVal handling in llc but some cases are not compatible with existing XL compiler on AIX. Adding a clang warning for such cases. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D105660 Files: clang/include/clang/Basic/DiagnosticSemaKinds.td clang/lib/Sema/SemaDeclAttr.cpp clang/test/Sema/aix-attr-align.c Index: clang/test/Sema/aix-attr-align.c =================================================================== --- /dev/null +++ clang/test/Sema/aix-attr-align.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify -fsyntax-only %s +// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -verify -fsyntax-only %s + +struct S { + int a[8] __attribute__((aligned(8))); // no-warning +}; + +struct T { + int a[4] __attribute__((aligned(16))); // expected-warning {{requested alignment of arguments 16 bytes or greater is not compatible with previous versions of the AIX XL compiler}} +}; + +struct U { + int a[2] __attribute__((aligned(32))); // expected-warning {{requested alignment of arguments 16 bytes or greater is not compatible with previous versions of the AIX XL compiler}} +}; Index: clang/lib/Sema/SemaDeclAttr.cpp =================================================================== --- clang/lib/Sema/SemaDeclAttr.cpp +++ clang/lib/Sema/SemaDeclAttr.cpp @@ -3954,6 +3954,9 @@ uint64_t AlignVal = Alignment.getZExtValue(); + if (Context.getTargetInfo().getTriple().isOSAIX() && (AlignVal >= 16)) + Diag(AttrLoc, diag::warn_not_xl_compatible) << E->getSourceRange(); + // C++11 [dcl.align]p2: // -- if the constant expression evaluates to zero, the alignment // specifier shall have no effect Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3251,6 +3251,10 @@ : Warning<"requested alignment must be %0 bytes or smaller; maximum " "alignment assumed">, InGroup<DiagGroup<"builtin-assume-aligned-alignment">>; +def warn_not_xl_compatible + : Warning<"requested alignment of arguments 16 bytes or greater is not" + " compatible with previous versions of the AIX XL compiler">, + InGroup<DiagGroup<"builtin-assume-aligned-alignment">>; def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< "%q0 redeclared without %1 attribute: previous %1 ignored">, InGroup<MicrosoftInconsistentDllImport>;
Index: clang/test/Sema/aix-attr-align.c =================================================================== --- /dev/null +++ clang/test/Sema/aix-attr-align.c @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -triple powerpc64-ibm-aix-xcoff -verify -fsyntax-only %s +// RUN: %clang_cc1 -triple powerpc-ibm-aix-xcoff -verify -fsyntax-only %s + +struct S { + int a[8] __attribute__((aligned(8))); // no-warning +}; + +struct T { + int a[4] __attribute__((aligned(16))); // expected-warning {{requested alignment of arguments 16 bytes or greater is not compatible with previous versions of the AIX XL compiler}} +}; + +struct U { + int a[2] __attribute__((aligned(32))); // expected-warning {{requested alignment of arguments 16 bytes or greater is not compatible with previous versions of the AIX XL compiler}} +}; Index: clang/lib/Sema/SemaDeclAttr.cpp =================================================================== --- clang/lib/Sema/SemaDeclAttr.cpp +++ clang/lib/Sema/SemaDeclAttr.cpp @@ -3954,6 +3954,9 @@ uint64_t AlignVal = Alignment.getZExtValue(); + if (Context.getTargetInfo().getTriple().isOSAIX() && (AlignVal >= 16)) + Diag(AttrLoc, diag::warn_not_xl_compatible) << E->getSourceRange(); + // C++11 [dcl.align]p2: // -- if the constant expression evaluates to zero, the alignment // specifier shall have no effect Index: clang/include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticSemaKinds.td +++ clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -3251,6 +3251,10 @@ : Warning<"requested alignment must be %0 bytes or smaller; maximum " "alignment assumed">, InGroup<DiagGroup<"builtin-assume-aligned-alignment">>; +def warn_not_xl_compatible + : Warning<"requested alignment of arguments 16 bytes or greater is not" + " compatible with previous versions of the AIX XL compiler">, + InGroup<DiagGroup<"builtin-assume-aligned-alignment">>; def warn_redeclaration_without_attribute_prev_attribute_ignored : Warning< "%q0 redeclared without %1 attribute: previous %1 ignored">, InGroup<MicrosoftInconsistentDllImport>;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits