<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/clang/lib/CodeGen/CodeGenTBAA.cpp, branch users/nico/python-1</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[CodeGen] Add TBAA struct path info for array members (#137719)</title>
<updated>2025-06-05T11:37:18+00:00</updated>
<author>
<name>Bruno De Fraine</name>
<email>brunodf@synopsys.com</email>
</author>
<published>2025-06-05T11:37:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c3b8a15eab06fceb6f4d0f2a0f505d5290ff208a'/>
<id>c3b8a15eab06fceb6f4d0f2a0f505d5290ff208a</id>
<content type='text'>
This enables the LLVM optimizer to view accesses to distinct struct
members as independent, also for array members. For example, the
following two stores no longer alias:

    struct S { int a[10]; int b; };
    void test(S *p, int i) {
      p-&gt;a[i] = ...;
      p-&gt;b = ...;
    }

Array members were already added to TBAA struct type nodes in commit
57493e29. Here, we extend a path tag for an array subscript expression.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This enables the LLVM optimizer to view accesses to distinct struct
members as independent, also for array members. For example, the
following two stores no longer alias:

    struct S { int a[10]; int b; };
    void test(S *p, int i) {
      p-&gt;a[i] = ...;
      p-&gt;b = ...;
    }

Array members were already added to TBAA struct type nodes in commit
57493e29. Here, we extend a path tag for an array subscript expression.</pre>
</div>
</content>
</entry>
<entry>
<title>[TBAA] Refine pointer-tbaa for void pointers by pointer depth (#126047)</title>
<updated>2025-02-20T12:06:56+00:00</updated>
<author>
<name>Bruno De Fraine</name>
<email>brunodf@synopsys.com</email>
</author>
<published>2025-02-20T12:06:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=458b1e9d2c61945f62b5bdfda93914d6a46b6cc7'/>
<id>458b1e9d2c61945f62b5bdfda93914d6a46b6cc7</id>
<content type='text'>
Commit 77d3f8a avoids distinct tags for any pointers where the ultimate
pointee type is `void`, to solve breakage in real-world code that uses
(indirections to) `void*` for polymorphism over different pointer types.

While this matches the TBAA implementation in GCC, this patch implements
a refinement that distinguishes void pointers by pointer depth, as
described in the "strict aliasing" documentation included in the
aforementioned commit:
&gt; `void*` is permitted to alias any pointer type, `void**` is permitted
&gt; to alias any pointer to pointer type, and so on.

For example, `void**` is no longer considered to alias `int*` in this
refinement, but it remains possible to use `void**` for polymorphism
over pointers to pointers.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 77d3f8a avoids distinct tags for any pointers where the ultimate
pointee type is `void`, to solve breakage in real-world code that uses
(indirections to) `void*` for polymorphism over different pointer types.

While this matches the TBAA implementation in GCC, this patch implements
a refinement that distinguishes void pointers by pointer depth, as
described in the "strict aliasing" documentation included in the
aforementioned commit:
&gt; `void*` is permitted to alias any pointer type, `void**` is permitted
&gt; to alias any pointer to pointer type, and so on.

For example, `void**` is no longer considered to alias `int*` in this
refinement, but it remains possible to use `void**` for polymorphism
over pointers to pointers.</pre>
</div>
</content>
</entry>
<entry>
<title>[TBAA] Don't emit pointer-tbaa for void pointers. (#122116)</title>
<updated>2025-01-31T11:38:14+00:00</updated>
<author>
<name>Florian Hahn</name>
<email>flo@fhahn.com</email>
</author>
<published>2025-01-31T11:38:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=77d3f8a92564b533a3c60a8c8e0657c38fd88ba1'/>
<id>77d3f8a92564b533a3c60a8c8e0657c38fd88ba1</id>
<content type='text'>
While there are no special rules in the standards regarding void
pointers and strict aliasing, emitting distinct tags for void pointers
break some common idioms and there is no good alternative to re-write
the code without strict-aliasing violations. An example is to count the
entries in an array of pointers:

    int count_elements(void * values) {
      void **seq = values;
      int count;
      for (count = 0; seq &amp;&amp; seq[count]; count++);
      return count;
    }

https://clang.godbolt.org/z/8dTv51v8W

An example in the wild is from
https://github.com/llvm/llvm-project/issues/119099

This patch avoids emitting distinct tags for void pointers, to avoid
those idioms causing mis-compiles for now.

Fixes https://github.com/llvm/llvm-project/issues/119099.
Fixes https://github.com/llvm/llvm-project/issues/122537.

PR: https://github.com/llvm/llvm-project/pull/122116</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
While there are no special rules in the standards regarding void
pointers and strict aliasing, emitting distinct tags for void pointers
break some common idioms and there is no good alternative to re-write
the code without strict-aliasing violations. An example is to count the
entries in an array of pointers:

    int count_elements(void * values) {
      void **seq = values;
      int count;
      for (count = 0; seq &amp;&amp; seq[count]; count++);
      return count;
    }

https://clang.godbolt.org/z/8dTv51v8W

An example in the wild is from
https://github.com/llvm/llvm-project/issues/119099

This patch avoids emitting distinct tags for void pointers, to avoid
those idioms causing mis-compiles for now.

Fixes https://github.com/llvm/llvm-project/issues/119099.
Fixes https://github.com/llvm/llvm-project/issues/122537.

PR: https://github.com/llvm/llvm-project/pull/122116</pre>
</div>
</content>
</entry>
<entry>
<title>[TySan] Add initial Type Sanitizer support to Clang) (#76260)</title>
<updated>2024-12-17T15:13:42+00:00</updated>
<author>
<name>Florian Hahn</name>
<email>flo@fhahn.com</email>
</author>
<published>2024-12-17T15:13:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=c135f6ffe2542bdde5a2a3e1d6515a6fc7031967'/>
<id>c135f6ffe2542bdde5a2a3e1d6515a6fc7031967</id>
<content type='text'>
This patch introduces the Clang components of type sanitizer: a
sanitizer for type-based aliasing violations.

It is based on Hal Finkel's https://reviews.llvm.org/D32198.

The Clang changes are mostly formulaic, the one specific change being
that when the TBAA sanitizer is enabled, TBAA is always generated, even
at -O0.

It goes together with the corresponding LLVM changes
(https://github.com/llvm/llvm-project/pull/76259) and compiler-rt
changes (https://github.com/llvm/llvm-project/pull/76261)

PR: https://github.com/llvm/llvm-project/pull/76260</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch introduces the Clang components of type sanitizer: a
sanitizer for type-based aliasing violations.

It is based on Hal Finkel's https://reviews.llvm.org/D32198.

The Clang changes are mostly formulaic, the one specific change being
that when the TBAA sanitizer is enabled, TBAA is always generated, even
at -O0.

It goes together with the corresponding LLVM changes
(https://github.com/llvm/llvm-project/pull/76259) and compiler-rt
changes (https://github.com/llvm/llvm-project/pull/76261)

PR: https://github.com/llvm/llvm-project/pull/76260</pre>
</div>
</content>
</entry>
<entry>
<title>[TBAA] Don't emit pointer tbaa for unnamed structs or unions. (#116596)</title>
<updated>2024-11-21T22:20:27+00:00</updated>
<author>
<name>Florian Hahn</name>
<email>flo@fhahn.com</email>
</author>
<published>2024-11-21T22:20:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=41a0c66f4379d43dcf7643bced22b9048e7ace96'/>
<id>41a0c66f4379d43dcf7643bced22b9048e7ace96</id>
<content type='text'>
For unnamed structs or unions, C's compatible types rule applies. Two
compatible types in different compilation units can have different
mangled names, meaning the metadata emitted below would incorrectly mark
them as no-alias. Use AnyPtr for such types in both C and C++, as C and
C++ types may be visible when doing LTO.

PR: https://github.com/llvm/llvm-project/pull/116596</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For unnamed structs or unions, C's compatible types rule applies. Two
compatible types in different compilation units can have different
mangled names, meaning the metadata emitted below would incorrectly mark
them as no-alias. Use AnyPtr for such types in both C and C++, as C and
C++ types may be visible when doing LTO.

PR: https://github.com/llvm/llvm-project/pull/116596</pre>
</div>
</content>
</entry>
<entry>
<title>[TBAA] Only emit pointer tbaa metedata for record types. (#116991)</title>
<updated>2024-11-21T20:01:06+00:00</updated>
<author>
<name>Florian Hahn</name>
<email>flo@fhahn.com</email>
</author>
<published>2024-11-21T20:01:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=decb87452d8e3b93b21ab9e4c3dd03d85cbebfa5'/>
<id>decb87452d8e3b93b21ab9e4c3dd03d85cbebfa5</id>
<content type='text'>
Be conservative if the type isn't a record type. Handling other types
may
require stripping const-qualifiers inside the type, e.g.
MemberPointerType.

Also look through array types same as through pointer types, to not
pessimize
arrays of pointers.

Without this, we assign different tags to the accesses for p an q in the
second test in cwg158.

PR: https://github.com/llvm/llvm-project/pull/116991</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Be conservative if the type isn't a record type. Handling other types
may
require stripping const-qualifiers inside the type, e.g.
MemberPointerType.

Also look through array types same as through pointer types, to not
pessimize
arrays of pointers.

Without this, we assign different tags to the accesses for p an q in the
second test in cwg158.

PR: https://github.com/llvm/llvm-project/pull/116991</pre>
</div>
</content>
</entry>
<entry>
<title>[CodeGen] Remove unused includes (NFC) (#116459)</title>
<updated>2024-11-16T15:37:13+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-11-16T15:37:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e8a6624325e0c628ec23e5f124f1d2002f138dd5'/>
<id>e8a6624325e0c628ec23e5f124f1d2002f138dd5</id>
<content type='text'>
Identified with misc-include-cleaner.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Identified with misc-include-cleaner.</pre>
</div>
</content>
</entry>
<entry>
<title>[TBAA] Extend pointer TBAA to pointers of non-builtin types. (#110569)</title>
<updated>2024-10-22T23:23:34+00:00</updated>
<author>
<name>Florian Hahn</name>
<email>flo@fhahn.com</email>
</author>
<published>2024-10-22T23:23:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4334f317e7fb2bdeaa15e912bbe0cd3162faf02c'/>
<id>4334f317e7fb2bdeaa15e912bbe0cd3162faf02c</id>
<content type='text'>
Extend the logic added in 123c036bd361d
(https://github.com/llvm/llvm-project/pull/76612) to support pointers to
non-builtin types by using the mangled name of the canonical type.

PR: https://github.com/llvm/llvm-project/pull/110569</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Extend the logic added in 123c036bd361d
(https://github.com/llvm/llvm-project/pull/76612) to support pointers to
non-builtin types by using the mangled name of the canonical type.

PR: https://github.com/llvm/llvm-project/pull/110569</pre>
</div>
</content>
</entry>
<entry>
<title>[clang-repl] [codegen] Reduce the state in TBAA. NFC for static compilation. (#98138)</title>
<updated>2024-08-21T05:22:31+00:00</updated>
<author>
<name>Vassil Vassilev</name>
<email>v.g.vassilev@gmail.com</email>
</author>
<published>2024-08-21T05:22:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=6c62ad446b2441b78ae524d9e700e351d5a76394'/>
<id>6c62ad446b2441b78ae524d9e700e351d5a76394</id>
<content type='text'>
In incremental compilation clang works with multiple `llvm::Module`s.
Our current approach is to create a CodeGenModule entity for every new
module request (via StartModule). However, some of the state such as the
mangle context needs to be preserved to keep the original semantics in
the ever-growing TU.

Fixes: llvm/llvm-project#95581.

cc: @jeaye</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In incremental compilation clang works with multiple `llvm::Module`s.
Our current approach is to create a CodeGenModule entity for every new
module request (via StartModule). However, some of the state such as the
mangle context needs to be preserved to keep the original semantics in
the ever-growing TU.

Fixes: llvm/llvm-project#95581.

cc: @jeaye</pre>
</div>
</content>
</entry>
<entry>
<title>[DataLayout] Remove constructor accepting a pointer to Module (#102841)</title>
<updated>2024-08-13T01:00:19+00:00</updated>
<author>
<name>Sergei Barannikov</name>
<email>barannikov88@gmail.com</email>
</author>
<published>2024-08-13T01:00:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=75c7bca740935a0cca462e28475dd6b046a6872c'/>
<id>75c7bca740935a0cca462e28475dd6b046a6872c</id>
<content type='text'>
The constructor initializes `*this` with `M-&gt;getDataLayout()`, which
is effectively the same as calling the copy constructor.
There does not seem to be a case where a copy would be necessary.

Pull Request: https://github.com/llvm/llvm-project/pull/102841
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The constructor initializes `*this` with `M-&gt;getDataLayout()`, which
is effectively the same as calling the copy constructor.
There does not seem to be a case where a copy would be necessary.

Pull Request: https://github.com/llvm/llvm-project/pull/102841
</pre>
</div>
</content>
</entry>
</feed>
