Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -5926,9 +5926,7 @@ MarshallingInfoInt, "8">; def fvisibility : Separate<["-"], "fvisibility">, HelpText<"Default type and symbol visibility">, - MarshallingInfoVisibility, "DefaultVisibility">, - // Always emitting because of the relation to `-mignore-xcoff-visibility`. - AlwaysEmit; + MarshallingInfoVisibility, "DefaultVisibility">; def ftype_visibility : Separate<["-"], "ftype-visibility">, HelpText<"Default type visibility">, MarshallingInfoVisibility, fvisibility.KeyPath>; Index: clang/lib/Frontend/CompilerInvocation.cpp =================================================================== --- clang/lib/Frontend/CompilerInvocation.cpp +++ clang/lib/Frontend/CompilerInvocation.cpp @@ -3737,28 +3737,7 @@ Opts.GNUCVersion = Major * 100 * 100 + Minor * 100 + Patch; } - // In AIX OS, the -mignore-xcoff-visibility is enable by default if there is - // no -fvisibility=* option. - // This is the reason why '-fvisibility' needs to be always generated: - // its absence implies '-mignore-xcoff-visibility'. - // - // Suppose the original cc1 command line does contain '-fvisibility default': - // '-mignore-xcoff-visibility' should not be implied. - // * If '-fvisibility' is not generated (as most options with default values - // don't), its absence would imply '-mignore-xcoff-visibility'. This changes - // the command line semantics. - // * If '-fvisibility' is generated regardless of its presence and value, - // '-mignore-xcoff-visibility' won't be implied and the command line - // semantics are kept intact. - // - // When the original cc1 command line does **not** contain '-fvisibility', - // '-mignore-xcoff-visibility' is implied. The generated command line will - // contain both '-fvisibility default' and '-mignore-xcoff-visibility' and - // subsequent calls to `CreateFromArgs`/`generateCC1CommandLine` will always - // produce the same arguments. - - if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility) || - !Args.hasArg(OPT_fvisibility))) + if (T.isOSAIX() && (Args.hasArg(OPT_mignore_xcoff_visibility))) Opts.IgnoreXCOFFVisibility = 1; if (Args.hasArg(OPT_ftrapv)) { Index: clang/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.cpp =================================================================== --- clang/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.cpp +++ clang/test/CodeGen/PowerPC/aix-ignore-xcoff-visibility.cpp @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -no-opaque-pointers -triple powerpc-unknown-aix -emit-llvm -o - -x c++ %s | \ -// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s +// RUN: FileCheck -check-prefix=VISIBILITY-IR %s // RUN: %clang_cc1 -no-opaque-pointers -triple powerpc-unknown-aix -emit-llvm -round-trip-args -o - -x c++ %s | \ -// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s +// RUN: FileCheck -check-prefix=VISIBILITY-IR %s // RUN: %clang_cc1 -no-opaque-pointers -triple powerpc-unknown-aix -mignore-xcoff-visibility -fvisibility default -emit-llvm -o - -x c++ %s | \ // RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s Index: clang/test/CodeGen/PowerPC/aix-visibility-inlines-hidden.cpp =================================================================== --- clang/test/CodeGen/PowerPC/aix-visibility-inlines-hidden.cpp +++ clang/test/CodeGen/PowerPC/aix-visibility-inlines-hidden.cpp @@ -1,13 +1,13 @@ // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large -emit-llvm -o - -x c++ %s | \ -// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s +// RUN: FileCheck -check-prefix=VISIBILITY-IR %s // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large \ // RUN: -fvisibility-inlines-hidden -emit-llvm -o - -x c++ %s | \ -// RUN: FileCheck -check-prefix=NOVISIBILITY-IR %s +// RUN: FileCheck -check-prefixes=VISIBILITY-IR,HIDDENINLINE-IR %s // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large -fvisibility-inlines-hidden \ // RUN: -fvisibility default -emit-llvm -o - -x c++ %s | \ -// RUN: FileCheck -check-prefix=VISIBILITY-IR %s +// RUN: FileCheck -check-prefixes=VISIBILITY-IR,HIDDENINLINE-IR %s // RUN: %clang_cc1 -triple powerpc-unknown-aix -mcmodel=large -mignore-xcoff-visibility -emit-llvm \ // RUN: -fvisibility-inlines-hidden -fvisibility default -o - -x c++ %s | \ @@ -30,7 +30,7 @@ return x; } -// VISIBILITY-IR: define linkonce_odr hidden void @_Z1fv() +// HIDDENINLINE-IR: define linkonce_odr hidden void @_Z1fv() // NOVISIBILITY-IR: define linkonce_odr void @_Z1fv() // VISIBILITY-IR: define linkonce_odr hidden void @_Z3foov()