[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-13 Thread Guy David via cfe-commits
guy-david wrote: > I just got a case: > > ``` > class A { > public: >class B { >public: > B(A *); > > // some non static data fields >}; > >B b(this); > }; > ``` > > Does this a valid prove that this optimization is not valid ? This example is fine because `

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-13 Thread Guy David via cfe-commits
guy-david wrote: > > @zygoloid Can you explain in your example why `a.n == 2` must be true, when > > your interpretation (which I understood in the same manner) of the > > standard's wording does indicate that the object's state is unspecified? > > My reading is that the standard says that the

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-09 Thread Guy David via cfe-commits
guy-david wrote: @efriedma-quic ping :) https://github.com/llvm/llvm-project/pull/136792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-06 Thread Guy David via cfe-commits
https://github.com/guy-david edited https://github.com/llvm/llvm-project/pull/136792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-04 Thread Guy David via cfe-commits
https://github.com/guy-david ready_for_review https://github.com/llvm/llvm-project/pull/136792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-05-04 Thread Guy David via cfe-commits
guy-david wrote: Comparison between latest Clang and GCC's output for a snippet out of a benchmark that could use this optimization: https://godbolt.org/z/35EEvcsPr. I've ran llvm-test-suite ten times for the before and after, it executed correctly and expectedly saw no performance gains: ```

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-04-23 Thread Guy David via cfe-commits
guy-david wrote: Yeah, I realize it's misplaced, I am not familiar with that part of the project, see the first paragraph in the PR description. I don't really agree with your second point about breaking people's existing assumptions on UB :) I am willing to run correctness suites to further v

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-04-22 Thread Guy David via cfe-commits
https://github.com/guy-david edited https://github.com/llvm/llvm-project/pull/136792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-04-22 Thread Guy David via cfe-commits
https://github.com/guy-david edited https://github.com/llvm/llvm-project/pull/136792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-04-22 Thread Guy David via cfe-commits
https://github.com/guy-david edited https://github.com/llvm/llvm-project/pull/136792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-04-22 Thread Guy David via cfe-commits
https://github.com/guy-david edited https://github.com/llvm/llvm-project/pull/136792 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add `noalias` to `this` pointer in C++ constructors (PR #136792)

2025-04-22 Thread Guy David via cfe-commits
https://github.com/guy-david created https://github.com/llvm/llvm-project/pull/136792 Note: the patch is probably amending the wrong piece of code, I've tried to add it to `buildThisParam` but hit an assertion because of a missing translation unit context. Clang, unlike GCC, does not transfor