Skip to content

Commit 4116360

Browse files
author
Florian Hahn
committed
Revert "[Clang] Enable -fpointer-tbaa by default. (llvm#117244)"
This reverts commit 7954a05.
1 parent e335290 commit 4116360

File tree

12 files changed

+470
-487
lines changed

12 files changed

+470
-487
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@ code bases.
5252
`migrate to Vulkan <https://developer.android.com/guide/topics/renderscript/migrate>`_
5353
or other options.
5454

55-
- Clang now emits distinct type-based alias analysis tags for incompatible
56-
pointers by default, enabling more powerful alias analysis when accessing
57-
pointer types. This change may silently change code behavior for code
58-
containing strict-aliasing violations. The new default behavior can be
59-
disabled using ``-fno-pointer-tbaa``.
60-
6155
C/C++ Language Potentially Breaking Changes
6256
-------------------------------------------
6357

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ ENUM_CODEGENOPT(StructReturnConvention, StructReturnConventionKind, 2, SRCK_Defa
242242

243243
CODEGENOPT(RelaxAll , 1, 0) ///< Relax all machine code instructions.
244244
CODEGENOPT(RelaxedAliasing , 1, 0) ///< Set when -fno-strict-aliasing is enabled.
245-
CODEGENOPT(PointerTBAA , 1, 1) ///< Whether or not to use distinct TBAA tags for pointers.
245+
CODEGENOPT(PointerTBAA, 1, 0) ///< Whether or not to use distinct TBAA tags for pointers.
246246
CODEGENOPT(StructPathTBAA , 1, 0) ///< Whether or not to use struct-path TBAA.
247247
CODEGENOPT(NewStructPathTBAA , 1, 0) ///< Whether or not to use enhanced struct-path TBAA.
248248
CODEGENOPT(SaveTempLabels , 1, 0) ///< Save temporary labels.

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7388,12 +7388,9 @@ def fuse_register_sized_bitfield_access: Flag<["-"], "fuse-register-sized-bitfie
73887388
def relaxed_aliasing : Flag<["-"], "relaxed-aliasing">,
73897389
HelpText<"Turn off Type Based Alias Analysis">,
73907390
MarshallingInfoFlag<CodeGenOpts<"RelaxedAliasing">>;
7391-
defm pointer_tbaa: BoolOption<"", "pointer-tbaa", CodeGenOpts<"PointerTBAA">,
7392-
DefaultTrue,
7393-
PosFlag<SetTrue, [], [ClangOption], "Enable">,
7394-
NegFlag<SetFalse, [], [ClangOption], "Disable">,
7395-
BothFlags<[], [ClangOption], " that single precision floating-point divide and sqrt used in ">>
7396-
;
7391+
def pointer_tbaa: Flag<["-"], "pointer-tbaa">,
7392+
HelpText<"Turn on Type Based Alias Analysis for pointer accesses">,
7393+
MarshallingInfoFlag<CodeGenOpts<"PointerTBAA">>;
73977394
def no_struct_path_tbaa : Flag<["-"], "no-struct-path-tbaa">,
73987395
HelpText<"Turn off struct-path aware Type Based Alias Analysis">,
73997396
MarshallingInfoNegativeFlag<CodeGenOpts<"StructPathTBAA">>;

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5940,9 +5940,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
59405940
if (!Args.hasFlag(options::OPT_fstrict_aliasing, StrictAliasingAliasOption,
59415941
options::OPT_fno_strict_aliasing, !IsWindowsMSVC))
59425942
CmdArgs.push_back("-relaxed-aliasing");
5943-
if (Args.hasFlag(options::OPT_fno_pointer_tbaa, options::OPT_fpointer_tbaa,
5943+
if (Args.hasFlag(options::OPT_fpointer_tbaa, options::OPT_fno_pointer_tbaa,
59445944
false))
5945-
CmdArgs.push_back("-no-pointer-tbaa");
5945+
CmdArgs.push_back("-pointer-tbaa");
59465946
if (!Args.hasFlag(options::OPT_fstruct_path_tbaa,
59475947
options::OPT_fno_struct_path_tbaa, true))
59485948
CmdArgs.push_back("-no-struct-path-tbaa");

clang/test/CodeGen/attr-counted-by.c

Lines changed: 19 additions & 38 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/tbaa-pointers.c

Lines changed: 102 additions & 102 deletions
Large diffs are not rendered by default.

clang/test/CodeGen/tbaa-reference.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes -no-pointer-tbaa %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,OLD-PATH
2-
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,OLD-PATH-POINTER
3-
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -no-pointer-tbaa -emit-llvm -new-struct-path-tbaa -o - | FileCheck %s -check-prefixes=CHECK,NEW-PATH
4-
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -emit-llvm -new-struct-path-tbaa -o - | FileCheck %s -check-prefixes=CHECK,NEW-PATH-POINTER
1+
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,OLD-PATH
2+
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes -pointer-tbaa %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,OLD-PATH-POINTER
3+
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -emit-llvm -new-struct-path-tbaa -o - | FileCheck %s -check-prefixes=CHECK,NEW-PATH
4+
// RUN: %clang_cc1 -triple x86_64-linux -O1 -disable-llvm-passes %s -pointer-tbaa -emit-llvm -new-struct-path-tbaa -o - | FileCheck %s -check-prefixes=CHECK,NEW-PATH-POINTER
55
//
66
// Check that we generate correct TBAA information for reference accesses.
77

clang/test/CodeGenCXX/template-instantiation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
// CHECK2-NOT: _ZTVN5test31SIiEE
1919
// CHECK2-NOT: _ZTSN5test31SIiEE
20-
// CHECK2: !{!"p1 _ZTSN5test31SIiEE",
2120

2221
// CHECK-LABEL: define linkonce_odr void @_ZN5test21CIiEC1Ev(ptr {{[^,]*}} %this) unnamed_addr
2322
// CHECK-LABEL: define linkonce_odr void @_ZN5test21CIiE6foobarIdEEvT_(

0 commit comments

Comments
 (0)