[clang] [Clang] [Sema] Reject non-power-of-2 `_BitInt` matrix element types (PR #117487)

2024-11-26 Thread Florian Hahn via cfe-commits
fhahn wrote: For reference, as per https://clang.llvm.org/docs/MatrixTypes.html#matrix-type, the only allowed element types for matrixes are * an integer type (as in C23 6.2.5p22), but excluding enumerated types and bool * the standard floating types float or double * a half-precision floating

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-12-03 Thread Florian Hahn via cfe-commits
fhahn wrote: ping :) @AaronBallman WDYT re making this clear in the release notes (also that there's an easy way to disable) + the ongoing work in parallel for the type sanitizer? https://github.com/llvm/llvm-project/pull/117244 ___ cfe-commits maili

[clang] Enable matrices in HLSL (PR #111415)

2024-12-03 Thread Florian Hahn via cfe-commits
@@ -852,34 +852,50 @@ void TypePrinter::printExtVectorAfter(const ExtVectorType *T, raw_ostream &OS) { void TypePrinter::printConstantMatrixBefore(const ConstantMatrixType *T, raw_ostream &OS) { + if (Policy.UseHLSLTypes) +OS <

[clang] Enable matrices in HLSL (PR #111415)

2024-12-03 Thread Florian Hahn via cfe-commits
@@ -459,8 +459,81 @@ void HLSLExternalSemaSource::defineHLSLVectorAlias() { HLSLNamespace->addDecl(Template); } +void HLSLExternalSemaSource::defineHLSLMatrixAlias() { + ASTContext &AST = SemaPtr->getASTContext(); fhahn wrote: Could you add a comment here

[clang] Enable matrices in HLSL (PR #111415)

2024-12-03 Thread Florian Hahn via cfe-commits
@@ -2447,7 +2447,7 @@ QualType Sema::BuildExtVectorType(QualType T, Expr *ArraySize, QualType Sema::BuildMatrixType(QualType ElementTy, Expr *NumRows, Expr *NumCols, SourceLocation AttrLoc) { - assert(Context.getLangOpts().MatrixTypes && + as

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-12-04 Thread Florian Hahn via cfe-commits
fhahn wrote: > I think this is a strict improvement over the general 'fstrict-aliasing' mode > we already have, and I see little value in maintaining separate levels of > strict aliasing conformance long term. > > I think it would not be a good situation for users to rely on some level of > s

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-12-04 Thread Florian Hahn via cfe-commits
https://github.com/fhahn closed https://github.com/llvm/llvm-project/pull/117244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add processor aliases back to -print-supported-cpus and -mcpu=help (PR #118581)

2024-12-09 Thread Florian Hahn via cfe-commits
@@ -25,3 +26,12 @@ // CHECK-ARM: cortex-a73 // CHECK-ARM: cortex-a75 // CHECK-ARM: Use -mcpu or -mtune to specify the target's processor. + +// RUN: %clang --target=arm64-apple-macosx --print-supported-cpus 2>&1 | \ +// RUN: FileCheck %s --check-prefix=CHECK-AARCH64 --implic

[clang] [llvm] Add processor aliases back to -print-supported-cpus and -mcpu=help (PR #118581)

2024-12-09 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/118581 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Add processor aliases back to -print-supported-cpus and -mcpu=help (PR #118581)

2024-12-09 Thread Florian Hahn via cfe-commits
@@ -137,8 +146,11 @@ static void cpuHelp(ArrayRef CPUTable) { // Print the CPU table. errs() << "Available CPUs for this target:\n\n"; - for (auto &CPU : CPUTable) -errs() << "\t" << CPU.Key << "\n"; + for (auto &CPU : CPUNames) { +if (CPU == "apple-latest") +

[clang] [llvm] Add processor aliases back to -print-supported-cpus and -mcpu=help (PR #118581)

2024-12-09 Thread Florian Hahn via cfe-commits
https://github.com/fhahn approved this pull request. LGTM, thanks. Add a few minor suggestions https://github.com/llvm/llvm-project/pull/118581 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe

[clang] [llvm] Add processor aliases back to -print-supported-cpus and -mcpu=help (PR #118581)

2024-12-09 Thread Florian Hahn via cfe-commits
@@ -104,14 +110,17 @@ static void Help(ArrayRef CPUTable, } // Determine the length of the longest CPU and Feature entries. - unsigned MaxCPULen = getLongestEntryLength(CPUTable); + unsigned MaxCPULen = getLongestEntryLength(CPUNames); unsigned MaxFeatLen = getLonges

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-12-09 Thread Florian Hahn via cfe-commits
fhahn wrote: > @fhahn we have identified a bunch of tests at google that fail somewhere in > the open source library https://code.videolan.org/videolan/x264. The `x264` > is built with `-fstrict-aliasing`. All tests pass when removing > `-fstrict-aliasing` or disabling Pointer-TBAA (`-fno-poin

[clang] [llvm] [tysan] Convert TySan from function+module pass to just module pass (PR #120667)

2024-12-28 Thread Florian Hahn via cfe-commits
https://github.com/fhahn approved this pull request. LGTM, thanks! https://github.com/llvm/llvm-project/pull/120667 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-06 Thread Florian Hahn via cfe-commits
https://github.com/fhahn created https://github.com/llvm/llvm-project/pull/121789 This patch adds a new __builtin_assume_dereferenceable to encode dereferenceability of a pointer using llvm.assume with an operand bundle. For now the builtin only accepts constant sizes, I am planning to drop th

[clang] [TySan] Don't report globals with incomplete types. (PR #121922)

2025-01-07 Thread Florian Hahn via cfe-commits
https://github.com/fhahn created https://github.com/llvm/llvm-project/pull/121922 Type metadata for incomplete types should also get handled at the place they are defined. Fixes https://github.com/llvm/llvm-project/issues/121014. >From d5f66784891b0bd1d8a23060ec104b3a7d07dbec Mon Sep 17 00:00

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-07 Thread Florian Hahn via cfe-commits
@@ -3430,13 +3430,15 @@ void FunctionStackPoisoner::processStaticAllocas() { SmallVector SVD; SVD.reserve(AllocaVec.size()); for (AllocaInst *AI : AllocaVec) { -ASanStackVariableDescription D = {AI->getName().data(), - ASan.getAllo

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-07 Thread Florian Hahn via cfe-commits
@@ -53,3 +53,4 @@ LLVM_FIXED_MD_KIND(MD_DIAssignID, "DIAssignID", 38) LLVM_FIXED_MD_KIND(MD_coro_outside_frame, "coro.outside.frame", 39) LLVM_FIXED_MD_KIND(MD_mmra, "mmra", 40) LLVM_FIXED_MD_KIND(MD_noalias_addrspace, "noalias.addrspace", 41) +LLVM_FIXED_MD_KIND(MD_unaltered_n

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-07 Thread Florian Hahn via cfe-commits
@@ -3430,13 +3430,15 @@ void FunctionStackPoisoner::processStaticAllocas() { SmallVector SVD; SVD.reserve(AllocaVec.size()); for (AllocaInst *AI : AllocaVec) { -ASanStackVariableDescription D = {AI->getName().data(), - ASan.getAllo

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-07 Thread Florian Hahn via cfe-commits
@@ -3430,13 +3430,15 @@ void FunctionStackPoisoner::processStaticAllocas() { SmallVector SVD; SVD.reserve(AllocaVec.size()); for (AllocaInst *AI : AllocaVec) { -ASanStackVariableDescription D = {AI->getName().data(), - ASan.getAllo

[clang] [TySan] Don't report globals with incomplete types. (PR #121922)

2025-01-07 Thread Florian Hahn via cfe-commits
https://github.com/fhahn closed https://github.com/llvm/llvm-project/pull/121922 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Restrict use of scalar types in vector builtins (PR #119423)

2025-01-06 Thread Florian Hahn via cfe-commits
fhahn wrote: Would be good to also update the documentation for the builtins the clarify the behavior. https://github.com/llvm/llvm-project/pull/119423 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/list

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-31 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/122116 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-31 Thread Florian Hahn via cfe-commits
https://github.com/fhahn closed https://github.com/llvm/llvm-project/pull/122116 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Docs] Fix typo in TypeSanitizer.rst "tale" -> "table" (NFC) (PR #126721)

2025-02-11 Thread Florian Hahn via cfe-commits
https://github.com/fhahn commented: Great, thanks for fixing this! https://github.com/llvm/llvm-project/pull/126721 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-29 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/122116 >From bac0f4a9dfbf375d876bc84c4474a533cbecec0e Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 8 Jan 2025 13:07:01 + Subject: [PATCH 1/7] [TBAA] Don't emit pointer-tbaa for void pointers. While there a

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-29 Thread Florian Hahn via cfe-commits
@@ -2489,6 +2489,30 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +Clang by default applies C/C++'s strict aliasing rules during optimizations. In +cases C and C++ rules diverge, the more conser

[clang] Fix link to TySan issues page (PR #125052)

2025-01-30 Thread Florian Hahn via cfe-commits
fhahn wrote: > ⚠️ We detected that you are using a GitHub private e-mail address to > contribute to the repo. Please turn off [Keep my email addresses > private](https://github.com/settings/emails) setting in your account. See > [LLVM > Discourse](https://discourse.llvm.org/t/hidden-emails-on

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-30 Thread Florian Hahn via cfe-commits
@@ -2489,6 +2489,81 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +The C and C++ standards require accesses to objects in memory to use l-values of +an appropriate type for the object. This is

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-30 Thread Florian Hahn via cfe-commits
@@ -2489,6 +2489,81 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +The C and C++ standards require accesses to objects in memory to use l-values of +an appropriate type for the object. This is

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-30 Thread Florian Hahn via cfe-commits
@@ -2489,6 +2489,81 @@ are listed below. $ clang -fuse-ld=lld -Oz -Wl,--icf=safe -fcodegen-data-use code.cc +Strict Aliasing +--- + +The C and C++ standards require accesses to objects in memory to use l-values of +an appropriate type for the object. This is

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-30 Thread Florian Hahn via cfe-commits
@@ -5272,6 +5296,8 @@ The Visual C++ Toolset has a slightly more elaborate mechanism for detection. Restrictions and Limitations compared to Clang -- +.. _clang_cl_strict_aliasing: + Strict Aliasing fhahn wrote: I

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-30 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/122116 >From 04ae49a9c6680c6c9f2f9f482fc1f25fffd0d4d5 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 8 Jan 2025 13:07:01 + Subject: [PATCH 1/8] [TBAA] Don't emit pointer-tbaa for void pointers. While there a

[clang] [compiler-rt] [llvm] [TySan] A Type Sanitizer (Runtime Library) (PR #76261)

2024-12-17 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/76261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [TySan] A Type Sanitizer (Clang) (PR #76260)

2024-12-17 Thread Florian Hahn via cfe-commits
https://github.com/fhahn closed https://github.com/llvm/llvm-project/pull/76260 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [TySan] A Type Sanitizer (Clang) (PR #76260)

2024-12-17 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/76260 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [TySan] A Type Sanitizer (Clang) (PR #76260)

2024-12-17 Thread Florian Hahn via cfe-commits
fhahn wrote: All 3 parts have been approved and the LLVM part just landed. I am planning on landing the Clang part and the compiler-rt part later today https://github.com/llvm/llvm-project/pull/76260 ___ cfe-commits mailing list cfe-commits@lists.llvm

[clang] [compiler-rt] [llvm] [TySan] A Type Sanitizer (Runtime Library) (PR #76261)

2024-12-17 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,161 @@ +# -*- Python -*- + +import os +import platform +import re + +import lit.formats + +# Get shlex.quote if available (added in 3.3), and fall back to pipes.quote if +# it's not available. +try: +import shlex + +sh_quote = shlex.quote +except: +import pi

[clang] [compiler-rt] [llvm] [TySan] A Type Sanitizer (Runtime Library) (PR #76261)

2024-12-17 Thread Florian Hahn via cfe-commits
https://github.com/fhahn closed https://github.com/llvm/llvm-project/pull/76261 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [TySan] A Type Sanitizer (Runtime Library) (PR #76261)

2024-12-17 Thread Florian Hahn via cfe-commits
fhahn wrote: AFAICT this is happening at each place that includes the file, e.g. also if you build AddressSanitizer. Not sure what the best way forward here is as this is not related to TypeSanitizer, but seems to impact all sanitizers? https://github.com/llvm/llvm-project/pull/76261 _

[clang] [compiler-rt] [llvm] [TySan] A Type Sanitizer (Runtime Library) (PR #76261)

2024-12-17 Thread Florian Hahn via cfe-commits
fhahn wrote: > I guess there are no release notes or manual b/c this is not ready to be used > by general users on the command line and that will come via another PR? I added a release note as part of the Clang patch to the `Sanitizers` section: https://clang.llvm.org/docs/ReleaseNotes.html#sa

[clang] [llvm] [LLVM][PhaseOrdering] Run CSE after InstCombine has cleaned the result of vectorisation. (PR #120443)

2024-12-18 Thread Florian Hahn via cfe-commits
@@ -1306,6 +1306,10 @@ void PassBuilder::addVectorPasses(OptimizationLevel Level, } // Cleanup after the loop optimization passes. FPM.addPass(InstCombinePass()); + // InstCombine can create CSE opportunities when it cleans the result of loop + // vectorization. They o

[clang] [TySan] Don't report globals with external storage. (PR #120565)

2024-12-19 Thread Florian Hahn via cfe-commits
https://github.com/fhahn created https://github.com/llvm/llvm-project/pull/120565 Globals with external storage should have been initialized where they are defined. Fixes https://github.com/llvm/llvm-project/issues/120448 >From a12283a7da8da16053f02ecf4f41c2eaa06717cd Mon Sep 17 00:00:00 2001

[clang] [llvm] [TySan] A Type Sanitizer (Clang) (PR #76260)

2024-12-19 Thread Florian Hahn via cfe-commits
@@ -105,11 +106,32 @@ void SanitizerMetadata::reportGlobal(llvm::GlobalVariable *GV, GV, Loc, Ty, "init"); GV->setSanitizerMetadata(Meta); + + if (Ty.isNull() || !CGM.getLangOpts().Sanitize.has(SanitizerKind::Type) ||

[clang] [TySan] Don't report globals with external storage. (PR #120565)

2024-12-19 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/120565 >From 75b6f8923dcb386d3520dbde762f3855af73aed4 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Thu, 19 Dec 2024 11:39:20 + Subject: [PATCH] [TySan] Don't report globals with external storage. Globals with e

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/116991 >From 09cd07bb30161fe927c55f1fe589d252d39b Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 20 Nov 2024 15:31:54 + Subject: [PATCH 1/4] [TBAA] Add run-line with -fpointer-tbaa to cwg158 --- clang/t

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
@@ -206,12 +206,14 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { if (!CodeGenOpts.PointerTBAA) return AnyPtr; // Compute the depth of the pointer and generate a tag of the form "p -// ". +// ". Look through pointer and array types to

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
@@ -206,12 +206,14 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { if (!CodeGenOpts.PointerTBAA) return AnyPtr; // Compute the depth of the pointer and generate a tag of the form "p -// ". +// ". Look through pointer and array types to

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-11-22 Thread Florian Hahn via cfe-commits
fhahn wrote: > What are the chances that this will exploit undefined behavior in existing > user code in ways that will make upgrading to the latest Clang more difficult > because of the perception of "miscompiles?" If this is a likely scenario for > users to hit, do other tools like UBSan (et

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-11-22 Thread Florian Hahn via cfe-commits
fhahn wrote: I'd also like to share a bit more info about the expected compile-time impact of the change: * stage1-O3 0.01%, * stage1-ReleaseThinLTO +0.04%, * stage1-ReleaseLTO-g +0.07% , * stage2-O3 -0.07% * clang build time +0.13% Full data: https://llvm-compile-time-tracker.com/compare.p

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/116991 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TBAA] Don't emit pointer tbaa for unnamed structs or unions. (PR #116596)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn closed https://github.com/llvm/llvm-project/pull/116596 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/117244 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TBAA] Don't emit pointer tbaa for unnamed structs or unions. (PR #116596)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/116596 >From df9460221a937f9a705f6ddf7c080ca9b7fa4e3f Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sun, 17 Nov 2024 20:07:57 + Subject: [PATCH 1/3] [TBAA] Don't emit pointer tbaa for unnamed structs or unions.

[clang] [TBAA] Don't emit pointer tbaa for unnamed structs or unions. (PR #116596)

2024-11-21 Thread Florian Hahn via cfe-commits
@@ -249,6 +249,21 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { if (!Ty->isRecordType()) return AnyPtr; + // For unnamed structs or unions C's compatible types rule applies. Two + // compatible types in different compilation units c

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
@@ -230,6 +232,11 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { ->getString(); TyName = Name; } else { + // Be conservative if the type a MemberPointerType. Those would require + // stripping const-qualifiers inside the typ

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn closed https://github.com/llvm/llvm-project/pull/116991 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TBAA] Don't emit pointer tbaa for unnamed structs or unions. (PR #116596)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/116596 >From df9460221a937f9a705f6ddf7c080ca9b7fa4e3f Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Sun, 17 Nov 2024 20:07:57 + Subject: [PATCH 1/2] [TBAA] Don't emit pointer tbaa for unnamed structs or unions.

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/116991 >From 3a8c157ca484db54a3e1d1ff8061d7b76ce46834 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 20 Nov 2024 15:31:54 + Subject: [PATCH 1/5] [TBAA] Add run-line with -fpointer-tbaa to cwg158 --- clang/t

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
@@ -205,14 +205,27 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { llvm::MDNode *AnyPtr = createScalarTypeNode("any pointer", getChar(), Size); if (!CodeGenOpts.PointerTBAA) return AnyPtr; -// Compute the depth of the pointer and generate a

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
@@ -18,10 +20,23 @@ struct A {}; // CHECK-LABEL: define {{.*}} @_Z1g const int *(A::*const *g(const int *(A::* const **p)[3], int *(A::***q)[3]))[3] { + // CHECK: load ptr, ptr %p.addr // CHECK: load ptr, {{.*}}, !tbaa ![[MEMPTR_TBAA:[^,]*]] const int *(A::*const *x)[3

[clang] [TBAA] Only emit pointer tbaa metedata for record types. (PR #116991)

2024-11-21 Thread Florian Hahn via cfe-commits
@@ -230,6 +243,12 @@ llvm::MDNode *CodeGenTBAA::getTypeInfoHelper(const Type *Ty) { ->getString(); TyName = Name; } else { + // Be conservative if the type isn't a RecordType. We are specifically fhahn wrote: Dropped, thanks htt

[clang] c4eeef3 - [TBAA] Add test for generating pointer-tbaa for unnamed structs.

2024-11-17 Thread Florian Hahn via cfe-commits
Author: Florian Hahn Date: 2024-11-17T20:04:36Z New Revision: c4eeef32d5dc8ec7560edabf18ac29416a7551e5 URL: https://github.com/llvm/llvm-project/commit/c4eeef32d5dc8ec7560edabf18ac29416a7551e5 DIFF: https://github.com/llvm/llvm-project/commit/c4eeef32d5dc8ec7560edabf18ac29416a7551e5.diff LOG:

[clang] [Clang] Enable -fpointer-tbaa by default. (PR #117244)

2024-12-03 Thread Florian Hahn via cfe-commits
fhahn wrote: > > ping :) @AaronBallman WDYT re making this clear in the release notes (also > > that there's an easy way to disable) + the ongoing work in parallel for the > > type sanitizer? > > I think it's a reasonable experiment to try. > > I would call it a potentially breaking change be

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/121789 >From 596d1346eb806e4c276042e50cca7514d3335f54 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Mon, 6 Jan 2025 13:39:55 + Subject: [PATCH 1/2] [Clang] Add __builtin_assume_dereferenceable to encode deref as

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Florian Hahn via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Florian Hahn via cfe-commits
@@ -3726,6 +3726,16 @@ RValue CodeGenFunction::EmitBuiltinExpr(const GlobalDecl GD, unsigned BuiltinID, AlignmentCI, OffsetValue); return RValue::get(PtrValue); } + case Builtin::BI__builtin_assume_dereferenceable: { +const Expr *Ptr = E-

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Florian Hahn via cfe-commits
@@ -839,6 +839,12 @@ def BuiltinAssumeAligned : Builtin { let Prototype = "void*(void const*, size_t, ...)"; } +def BuiltinAssumeDereferenceable : Builtin { + let Spellings = ["__builtin_assume_dereferenceable"]; + let Attributes = [NoThrow, Const, Constexpr];

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Florian Hahn via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-08 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/121789 >From 596d1346eb806e4c276042e50cca7514d3335f54 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Mon, 6 Jan 2025 13:39:55 + Subject: [PATCH 1/3] [Clang] Add __builtin_assume_dereferenceable to encode deref as

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-08 Thread Florian Hahn via cfe-commits
https://github.com/fhahn created https://github.com/llvm/llvm-project/pull/122116 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 co

[clang] 346fad5 - [TBAA] Simplify checks for unnamed struct case, where anyptr is used.

2025-01-08 Thread Florian Hahn via cfe-commits
Author: Florian Hahn Date: 2025-01-08T14:08:28Z New Revision: 346fad5c2c28d0cd39475ae979ee468a420ebed7 URL: https://github.com/llvm/llvm-project/commit/346fad5c2c28d0cd39475ae979ee468a420ebed7 DIFF: https://github.com/llvm/llvm-project/commit/346fad5c2c28d0cd39475ae979ee468a420ebed7.diff LOG:

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Florian Hahn via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Florian Hahn via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the -

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Florian Hahn via cfe-commits
@@ -2761,6 +2761,41 @@ etc.). Query for this feature with ``__has_builtin(__builtin_assume_separate_storage)``. +``__builtin_assume_dereferenceable`` +- + +``__builtin_assume_derefernceable`` is used to provide the optimizer with the +know

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,36 @@ +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s + +// CHECK-LABEL: @test1( +// CHECK-NEXT: entry: +// CHECK-NEXT:[[A_ADDR:%.*]] = alloca ptr,

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Florian Hahn via cfe-commits
@@ -839,6 +839,12 @@ def BuiltinAssumeAligned : Builtin { let Prototype = "void*(void const*, size_t, ...)"; } +def BuiltinAssumeDereferenceable : Builtin { + let Spellings = ["__builtin_assume_dereferenceable"]; + let Attributes = [NoThrow, Const, Constexpr];

[clang] [llvm] [Clang] Add __builtin_assume_dereferenceable to encode deref assumption. (PR #121789)

2025-01-09 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/121789 >From 2c7c9bbf17f5c3c78c85dc91540004d75707ebe5 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Mon, 6 Jan 2025 13:39:55 + Subject: [PATCH 1/4] [Clang] Add __builtin_assume_dereferenceable to encode deref as

[clang] [flang] [llvm] [IR] Convert from nocapture to captures(none) (PR #123181)

2025-01-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/123181 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [flang] [llvm] [IR] Convert from nocapture to captures(none) (PR #123181)

2025-01-21 Thread Florian Hahn via cfe-commits
https://github.com/fhahn approved this pull request. LGTM, thanks https://github.com/llvm/llvm-project/pull/123181 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -3391,6 +3391,27 @@ static void findStoresToUninstrumentedArgAllocas( } } +StringRef getAllocaName(AllocaInst *AI) { + // Alloca could have been renamed for uniqueness. Its true name will have been + // recorded as an annotation. + if (AI->hasMetadata(LLVMContext::MD_

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -3391,6 +3391,27 @@ static void findStoresToUninstrumentedArgAllocas( } } +StringRef getAllocaName(AllocaInst *AI) { + // Alloca could have been renamed for uniqueness. Its true name will have been + // recorded as an annotation. + if (AI->hasMetadata(LLVMContext::MD_

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -3391,6 +3391,27 @@ static void findStoresToUninstrumentedArgAllocas( } } +StringRef getAllocaName(AllocaInst *AI) { + // Alloca could have been renamed for uniqueness. Its true name will have been + // recorded as an annotation. + if (AI->hasMetadata(LLVMContext::MD_

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -3391,6 +3391,27 @@ static void findStoresToUninstrumentedArgAllocas( } } +StringRef getAllocaName(AllocaInst *AI) { + // Alloca could have been renamed for uniqueness. Its true name will have been + // recorded as an annotation. + if (AI->hasMetadata(LLVMContext::MD_

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -3391,6 +3391,27 @@ static void findStoresToUninstrumentedArgAllocas( } } +StringRef getAllocaName(AllocaInst *AI) { + // Alloca could have been renamed for uniqueness. Its true name will have been + // recorded as an annotation. + if (AI->hasMetadata(LLVMContext::MD_

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -134,6 +134,12 @@ llvm::AllocaInst *CodeGenFunction::CreateTempAlloca(llvm::Type *Ty, Alloca = new llvm::AllocaInst(Ty, CGM.getDataLayout().getAllocaAddrSpace(), ArraySize, Name, AllocaInsertPt->getIterator()); + llvm::errs() << "Al

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -3425,12 +3446,14 @@ void FunctionStackPoisoner::processStaticAllocas() { ArgInitInst->moveBefore(InsBefore); // If we have a call to llvm.localescape, keep it in the entry block. - if (LocalEscapeCall) LocalEscapeCall->moveBefore(InsBefore); + if (LocalEscapeCall)

[clang] [compiler-rt] [llvm] [ASan] Add metadata to renamed instructions so ASan doesn't use the i… (PR #119387)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -3391,6 +3391,27 @@ static void findStoresToUninstrumentedArgAllocas( } } +StringRef getAllocaName(AllocaInst *AI) { fhahn wrote: ```suggestion static StringRef getAllocaName(AllocaInst *AI) { ``` https://github.com/llvm/llvm-project/pull/119387 ___

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/123595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
https://github.com/fhahn commented: Thanks for putting this up! https://github.com/llvm/llvm-project/pull/123595 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TySan] Add initial documentation for Type Sanitizer (PR #123595)

2025-01-20 Thread Florian Hahn via cfe-commits
@@ -0,0 +1,153 @@ + +TypeSanitizer + + +.. contents:: + :local: + +Introduction + + +TypeSanitizer is a detector for strict type aliasing violations. It consists of a compiler +instrumentation module and a run-time library. The tool d

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-28 Thread Florian Hahn via cfe-commits
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/122116 >From adbcc4fc5044d82bd983671ef5442142a3f498fe Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Wed, 8 Jan 2025 13:07:01 + Subject: [PATCH 1/4] [TBAA] Don't emit pointer-tbaa for void pointers. While there a

[clang] [TBAA] Don't emit pointer-tbaa for void pointers. (PR #122116)

2025-01-28 Thread Florian Hahn via cfe-commits
fhahn wrote: > Okay, so if the ultimate pointee type is `void`, we're basically treating > that as a generic pointer, no matter what the pointer depth is? I guess that > makes sense. > > > What would be a good place to document this? > > Hmm, I was hoping that we would have a section in the m

<    1   2   3   4   5   6   7   >