[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-05-25 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/98746 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-05-23 Thread Yingwei Zheng via cfe-commits
@@ -2916,9 +2916,30 @@ CodeGenFunction::EmitLoadOfReference(LValue RefLVal, llvm::LoadInst *Load = Builder.CreateLoad(RefLVal.getAddress(), RefLVal.isVolatile()); CGM.DecorateInstructionWithTBAA(Load, RefLVal.getTBAAInfo()); - return makeNaturalAddressForPointer(Load

[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-05-23 Thread Yingwei Zheng via cfe-commits
@@ -20,10 +20,10 @@ void test_add_template() { // CHECK: %call = call noundef <10 x float> @_Z3addIfLj2ELj5EEN8MyMatrixIT_XT0_EXT1_EE8matrix_tERS2_S4_(ptr noundef nonnull align 4 dereferenceable(40) %Mat1, ptr noundef nonnull align 4 dereferenceable(40) %Mat2) //

[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-05-20 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: Ping. https://github.com/llvm/llvm-project/pull/98746 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SimplifyCFG] Extend jump-threading to allow live local defs (PR #135079)

2025-05-13 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw commented: It is not obvious to judge whether this patch is profitable. Can you share some performance data on SPEC/LLVM test-suite/your motivating case? https://github.com/llvm/llvm-project/pull/135079 ___ cfe-commits mail

[clang] [llvm] [SimplifyCFG] Extend jump-threading to allow live local defs (PR #135079)

2025-05-13 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/135079 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [SimplifyCFG] Extend jump-threading to allow live local defs (PR #135079)

2025-05-13 Thread Yingwei Zheng via cfe-commits
@@ -3467,13 +3485,23 @@ static bool blockIsSimpleEnoughToThreadThrough(BasicBlock *BB) { // live outside of the current basic block. for (User *U : I.users()) { Instruction *UI = cast(U); - if (UI->getParent() != BB || isa(UI)) -return false; +

[clang] [llvm] [SimplifyCFG] Extend jump-threading to allow live local defs (PR #135079)

2025-05-13 Thread Yingwei Zheng via cfe-commits
@@ -3442,10 +3442,28 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI, return true; } +typedef SmallPtrSet BlocksSet; dtcxzyw wrote: ```suggestion using BlocksSet = SmallPtrSet; ``` https://github.com/llvm/llvm-project/pull/135079 ___

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-05-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/137851 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-05-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137851 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-08 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/137849 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-08 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137849 >From 5b3a9ed3ed2f258a178e0c17891e2d9ae4f21446 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 6 May 2025 17:47:07 +0800 Subject: [PATCH 1/4] [Clang][CodeGen] Enable pointer overflow check for GCC worka

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-08 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137849 >From 5b3a9ed3ed2f258a178e0c17891e2d9ae4f21446 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 6 May 2025 17:47:07 +0800 Subject: [PATCH 1/3] [Clang][CodeGen] Enable pointer overflow check for GCC worka

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-08 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137849 >From 5b3a9ed3ed2f258a178e0c17891e2d9ae4f21446 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 6 May 2025 17:47:07 +0800 Subject: [PATCH 1/2] [Clang][CodeGen] Enable pointer overflow check for GCC worka

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-08 Thread Yingwei Zheng via cfe-commits
@@ -4169,10 +4169,10 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // The index is not pointer-sized. // The pointer type is not byte-sized. // - if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(), -

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-05-06 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137851 >From 5b3a9ed3ed2f258a178e0c17891e2d9ae4f21446 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 6 May 2025 17:47:07 +0800 Subject: [PATCH 1/4] [Clang][CodeGen] Enable pointer overflow check for GCC worka

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits
@@ -4169,10 +4169,10 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // The index is not pointer-sized. // The pointer type is not byte-sized. // - if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(), -

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits
@@ -4169,11 +4169,16 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // The index is not pointer-sized. // The pointer type is not byte-sized. // - if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(), -

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-05-06 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137851 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-s

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/137849 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Enable pointer overflow check for GCC workaround (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/137849 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137849 >From 5b3a9ed3ed2f258a178e0c17891e2d9ae4f21446 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 6 May 2025 17:47:07 +0800 Subject: [PATCH] [Clang][CodeGen] Enable pointer overflow check for GCC workaroun

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits
@@ -4169,11 +4169,16 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // The index is not pointer-sized. // The pointer type is not byte-sized. // - if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(), -

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-06 Thread Yingwei Zheng via cfe-commits
@@ -4169,11 +4169,16 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, // The index is not pointer-sized. // The pointer type is not byte-sized. // - if (BinaryOperator::isNullPointerArithmeticExtension(CGF.getContext(), -

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `isNullPointerArithmeticExtension` (PR #137849)

2025-05-04 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/137849 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-05-04 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137849 >From f1db3a540ec1383451955efab62b64ed8d180349 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 30 Apr 2025 01:26:41 +0800 Subject: [PATCH 1/4] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-05-04 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: See also the response from the Clang Area Team: https://discourse.llvm.org/t/rfc-implement-gcc-bound-pmf-in-clang/85951/7. https://github.com/llvm/llvm-project/pull/135649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-05-04 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/135649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-05-01 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137851 >From f1db3a540ec1383451955efab62b64ed8d180349 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 30 Apr 2025 01:26:41 +0800 Subject: [PATCH 1/5] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-05-01 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137849 >From f1db3a540ec1383451955efab62b64ed8d180349 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 30 Apr 2025 01:26:41 +0800 Subject: [PATCH 1/3] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-05-01 Thread Yingwei Zheng via cfe-commits
@@ -4238,7 +4238,8 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, else elemTy = CGF.ConvertTypeForMem(elementType); - if (CGF.getLangOpts().PointerOverflowDefined) + if (CGF.getLangOpts().PointerOverflowDefined || + CGF.isUnderlyingBasePointerConstan

[clang] [llvm] [IR] Do not store Function inside BlockAddress (PR #137958)

2025-04-30 Thread Yingwei Zheng via cfe-commits
@@ -912,6 +912,11 @@ class BlockAddress final : public Constant { /// block must be embedded into a function. static BlockAddress *get(BasicBlock *BB); + /// Return a BlockAddress for the specified basic block, which may not be + /// part of a function. The specified typ

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-04-30 Thread Yingwei Zheng via cfe-commits
@@ -4820,6 +4820,9 @@ bool CodeGenFunction::isUnderlyingBasePointerConstantNull(const Expr *E) { const Expr *UnderlyingBaseExpr = E->IgnoreParens(); while (auto *BaseMemberExpr = dyn_cast(UnderlyingBaseExpr)) UnderlyingBaseExpr = BaseMemberExpr->getBase()->IgnoreParens

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-04-30 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137851 >From f1db3a540ec1383451955efab62b64ed8d180349 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 30 Apr 2025 01:26:41 +0800 Subject: [PATCH 1/4] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-04-29 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > While we should omit inbounds, I think it would be good to not suppress the > sanitizer. If the sanitizer doesn't warn about it, then things will never get > better :( Fixed. https://github.com/llvm/llvm-project/pull/137849 ___ cfe-

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-04-29 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/137849 >From f1db3a540ec1383451955efab62b64ed8d180349 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 30 Apr 2025 01:26:41 +0800 Subject: [PATCH 1/2] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-04-29 Thread Yingwei Zheng via cfe-commits
@@ -4238,7 +4238,8 @@ static Value *emitPointerArithmetic(CodeGenFunction &CGF, else elemTy = CGF.ConvertTypeForMem(elementType); - if (CGF.getLangOpts().PointerOverflowDefined) + if (CGF.getLangOpts().PointerOverflowDefined || + CGF.isUnderlyingBasePointerConstan

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-04-29 Thread Yingwei Zheng via cfe-commits
@@ -4820,6 +4820,9 @@ bool CodeGenFunction::isUnderlyingBasePointerConstantNull(const Expr *E) { const Expr *UnderlyingBaseExpr = E->IgnoreParens(); while (auto *BaseMemberExpr = dyn_cast(UnderlyingBaseExpr)) UnderlyingBaseExpr = BaseMemberExpr->getBase()->IgnoreParens

[clang] [Clang][CodeGen] Add workaround for old glibc `__PTR_ALIGN` macro (PR #137851)

2025-04-29 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/137851 Closes https://github.com/llvm/llvm-project/issues/137833. This patch is stacked on https://github.com/llvm/llvm-project/pull/137849. >From f1db3a540ec1383451955efab62b64ed8d180349 Mon Sep 17 00:00:00 2001 From

[clang] [Clang][CodeGen] Check `isUnderlyingBasePointerConstantNull` in `emitPointerArithmetic` (PR #137849)

2025-04-29 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/137849 Do not set inbounds on GEP when the pointer operand is a constant null. Note: This patch is fragile :( For a more complex case `(int*)0 + offset1 + offset2`, we still set inbounds for the second addition. Rela

[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-04-25 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > Do we have a ubsan check for this? We have a ubsan check on deref. I think it is enough. https://github.com/llvm/llvm-project/pull/98746 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/l

[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-04-24 Thread Yingwei Zheng via cfe-commits
@@ -1,8 +1,8 @@ // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s -O2 | FileCheck %s -// Make sure the call to b() doesn't get optimized out. +// Make sure the call to b() is eliminated. extern struct x {char& x,y;}y; int b(); int a() { if (!&y.x) b();

[clang] [Clang][CodeGen] Add metadata for load from reference (PR #98746)

2025-04-24 Thread Yingwei Zheng via cfe-commits
@@ -2799,9 +2799,30 @@ CodeGenFunction::EmitLoadOfReference(LValue RefLVal, llvm::LoadInst *Load = Builder.CreateLoad(RefLVal.getAddress(), RefLVal.isVolatile()); CGM.DecorateInstructionWithTBAA(Load, RefLVal.getTBAAInfo()); - return makeNaturalAddressForPointer(Load

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-21 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > > IIRC this feature is orthogonal to GCC bound member functions. `declcall` > > with a virtual method just returns a pmf, and we still need to perform > > vtable lookup at the callsite: https://compiler-explorer.com/z/YrT3nPTEz > > Try `declcall(p->B::virtual_method())`?: > h

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-21 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > > We used this extension to improve virtual function calling performance, > > there are simple and small virtual functions which are frequently called > > and can not be eliminated and it is in a delegation thus compiler can not > > optimize. > > [toplingdb](https://github.com

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-19 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: @vitalybuka @mstorsjo Can you please provide the command to reproduce the wrong IR/codegen? https://github.com/llvm/llvm-project/pull/135135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman

[clang] Revert "[Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers" (PR #136402)

2025-04-18 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw approved this pull request. https://github.com/llvm/llvm-project/pull/136402 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-18 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > This change broke a couple of ubsan tests on i686 on Windows (i.e. a 32 bit > environment): > https://github.com/mstorsjo/llvm-mingw/actions/runs/14527591706/job/40770945907 > > The failing tests are > https://github.com/llvm/llvm-project/blob/llvmorg-20.1.3/compiler-rt/test/

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-18 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/135135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-04-18 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/135658 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-04-18 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw commented: I don't see the necessity of using operand bundles. All of the possible arguments are metadata strings, not SSA values. Can't we just use metadata instead? ``` call float @llvm.nearbyint.f32(float %x), !fp.control !{ !"dyn"}, !fp.except !{ !"strict"} ```

[clang] [llvm] Minimal support of floating-point operand bundles (PR #135658)

2025-04-18 Thread Yingwei Zheng via cfe-commits
@@ -0,0 +1,24 @@ +//===- llvm/IR/FloatingPointOps.def - FP intrinsics -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apa

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-17 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/135135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-17 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135135 >From de6d895ebb26225db909f8506f77162f38a3f65f Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 10 Apr 2025 11:09:45 +0800 Subject: [PATCH 1/4] [Clang][CodeGen][UBSan] Add more precise attributes to reco

[clang] [Clang][CodeGen][OpenCL] Add `-fno-delete-null-pointer-checks` to avoid UB. NFC. (PR #135602)

2025-04-16 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/135602 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-16 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > > This patch adds support for GCC bound member functions extension: > > https://gcc.gnu.org/onlinedocs/gcc/Bound-member-functions.html > > Related issue: #22495 Closes #82727 > > I think this requires an RFC justifying carrying the extension. It's a > non-conforming extension

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-16 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/135649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-16 Thread Yingwei Zheng via cfe-commits
@@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -triple %itanium_abi_triple -fsyntax-only %s -verify dtcxzyw wrote: For reference: https://godbolt.org/z/Mf719b3en https://github.com/llvm/llvm-project/pull/135649 ___ cfe-commits

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-16 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw ready_for_review https://github.com/llvm/llvm-project/pull/135649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-16 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 24ed3a2a46bf6aef3678a474eb4babd65baf551a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 16 Apr 2025 00:13:34 +0800 Subject: [PATCH] [Clang] Add support for GCC bound member functions extension --

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 43c487cd6206a215542a7711b1e2b5c48e4d4ecb Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 16 Apr 2025 00:13:34 +0800 Subject: [PATCH] [Clang] Add support for GCC bound member functions extension --

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/135649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 445c08bcb007f157f6c66c5fabb01c2aa88b3a89 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 22:58:44 +0800 Subject: [PATCH 1/2] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6f0a3ba5852134d8bd04679438866e6f373f494a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 12:12:19 +0800 Subject: [PATCH 1/4] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 445c08bcb007f157f6c66c5fabb01c2aa88b3a89 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 22:58:44 +0800 Subject: [PATCH] [Clang] Add support for GCC bound member functions extension --

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6f0a3ba5852134d8bd04679438866e6f373f494a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 12:12:19 +0800 Subject: [PATCH 1/7] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6f0a3ba5852134d8bd04679438866e6f373f494a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 12:12:19 +0800 Subject: [PATCH 1/6] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-15 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6f0a3ba5852134d8bd04679438866e6f373f494a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 12:12:19 +0800 Subject: [PATCH 1/5] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-14 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6f0a3ba5852134d8bd04679438866e6f373f494a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 12:12:19 +0800 Subject: [PATCH 1/3] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-14 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6f0a3ba5852134d8bd04679438866e6f373f494a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 12:12:19 +0800 Subject: [PATCH 1/2] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-14 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6f0a3ba5852134d8bd04679438866e6f373f494a Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 12:12:19 +0800 Subject: [PATCH] [Clang] Add support for GCC bound member functions extension --

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-14 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135649 >From 6795a5143129520d2db343d768507174a70da453 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 01:24:10 +0800 Subject: [PATCH 1/2] [Clang] Add support for GCC bound member functions extensio

[clang] [Clang][CodeGen][OpenCL] Add `-fno-delete-null-pointer-checks` to avoid UB. NFC. (PR #135602)

2025-04-14 Thread Yingwei Zheng via cfe-commits
@@ -1,4 +1,4 @@ -// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 %s -triple "spir-unknown-unknown" -fno-delete-null-pointer-checks -emit-llvm -o - | FileCheck %s dtcxzyw wrote: The default optimization lev

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-14 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/135649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Add support for GCC bound member functions extension (PR #135649)

2025-04-14 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/135649 None >From 6795a5143129520d2db343d768507174a70da453 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 15 Apr 2025 01:24:10 +0800 Subject: [PATCH] [Clang] Add support for GCC bound member functions extensi

[clang] [Clang][CodeGen][OpenCL] Add `-fno-delete-null-pointer-checks` to avoid UB. NFC. (PR #135602)

2025-04-14 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/135602 Needed by https://github.com/llvm/llvm-project/pull/130742. >From e58df222ea5a12e302094b4fc77b0e77cbbc3e60 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Mon, 14 Apr 2025 17:18:09 +0800 Subject: [PATCH] [C

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-12 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw ready_for_review https://github.com/llvm/llvm-project/pull/135135 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-12 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/135135 >From c0d8765b48fac979ab46eba4fd2cde85595c31e0 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 10 Apr 2025 11:09:45 +0800 Subject: [PATCH 1/3] [Clang][CodeGen][UBSan] Add more precise attributes to reco

[clang] [Clang][CodeGen] Do not set inbounds flag in `EmitMemberDataPointerAddress` when the base pointer is null (PR #130952)

2025-04-10 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/130952 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Do not set inbounds flag in `EmitMemberDataPointerAddress` when the base pointer is null (PR #130952)

2025-04-10 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130952 >From 9a9c7cf2eff8c740789e9702a190af6dbd3f5014 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Wed, 12 Mar 2025 20:17:28 +0800 Subject: [PATCH 1/3] [Clang][CodeGen] Do not set inbounds in `EmitMemberDataPoin

[clang] [Reland][Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #135135)

2025-04-10 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > Still not sure how https://github.com/llvm/llvm-project/pull/135141 is > related. We add a new parameter `bool &MayReadFromPtrToInt` to `CodeGenFunction::EmitCheckValue`. If it is called outside `CodeGenFunction::EmitCheck`, we have to pass the result into `EmitCheck` as wel

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-10 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/130734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] Revert "[Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers" (PR #135130)

2025-04-10 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/135130 Reverts llvm/llvm-project#130990 Breaks buildbot https://lab.llvm.org/buildbot/#/builders/186/builds/8072 >From 346c905e8ab7cb81c537eb5be1d57cc63a41daea Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu,

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130734 >From 0f6ff605da3cbadc5311d4bf6c08fe98970a69c3 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 10 Apr 2025 09:54:33 +0800 Subject: [PATCH 1/3] [Clang][CodeGen] Do not set inbounds flag for struct GEP wi

[clang] [Clang][CodeGen] Do not set inbounds flag in `EmitMemberDataPointerAddress` when the base pointer is null (PR #130952)

2025-04-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130952 >From 0f6ff605da3cbadc5311d4bf6c08fe98970a69c3 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 10 Apr 2025 09:54:33 +0800 Subject: [PATCH 1/5] [Clang][CodeGen] Do not set inbounds flag for struct GEP wi

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130734 >From 0f6ff605da3cbadc5311d4bf6c08fe98970a69c3 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 10 Apr 2025 09:54:33 +0800 Subject: [PATCH 1/2] [Clang][CodeGen] Do not set inbounds flag for struct GEP wi

[clang] [Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #130990)

2025-04-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/130990 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-09 Thread Yingwei Zheng via cfe-commits
@@ -42,6 +42,11 @@ Potentially Breaking Changes C/C++ Language Potentially Breaking Changes --- +- Some old-style offsetof idioms like ``((int)(&(((struct S *)0)->field)))`` are treated dtcxzyw wrote: Fixed. https://g

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-09 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: Rebased on the top of https://github.com/llvm/llvm-project/pull/134269 and https://github.com/llvm/llvm-project/pull/134221 https://github.com/llvm/llvm-project/pull/130734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:/

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130734 >From 0f6ff605da3cbadc5311d4bf6c08fe98970a69c3 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 10 Apr 2025 09:54:33 +0800 Subject: [PATCH] [Clang][CodeGen] Do not set inbounds flag for struct GEP with n

[clang] [Clang][CodeGen] Respect -fwrapv-pointer when emitting struct GEPs (PR #134269)

2025-04-09 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/134269 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Respect -fwrapv-pointer when emitting struct GEPs (PR #134269)

2025-04-09 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: @efriedma-quic Any more comments? https://github.com/llvm/llvm-project/pull/134269 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Respect -fwrapv-pointer when emitting struct GEPs (PR #134269)

2025-04-08 Thread Yingwei Zheng via cfe-commits
@@ -10,3 +10,24 @@ void test(void) { // DEFAULT: getelementptr inbounds nuw i32, ptr // FWRAPV-POINTER: getelementptr i32, ptr } + +struct S { + int a; + int b; + int c: 10; dtcxzyw wrote: Bitfields are handled by a different code path: https://github.

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-05 Thread Yingwei Zheng via cfe-commits
@@ -42,6 +42,11 @@ Potentially Breaking Changes C/C++ Language Potentially Breaking Changes --- +- Some old-style offsetof idioms like ``((int)(&(((struct S *)0)->field)))`` are treated dtcxzyw wrote: > then describes

[clang] [Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #130990)

2025-04-05 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > willreturn means we eliminate the call The ubsan handler cannot be eliminated because `inaccessiblemem: readwrite` indicates that it has externally observable side effects. BTW, I just worry that some risky instructions (e.g., divided by zero) may be moved before the handler

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-05 Thread Yingwei Zheng via cfe-commits
@@ -42,6 +42,11 @@ Potentially Breaking Changes C/C++ Language Potentially Breaking Changes --- +- Some old-style offsetof idioms like ``((int)(&(((struct S *)0)->field)))`` are treated dtcxzyw wrote: I think it is jus

[clang] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-04-05 Thread Yingwei Zheng via cfe-commits
@@ -64,21 +64,27 @@ class CGBuilderTy : public CGBuilderBaseTy { Address createConstGEP2_32(Address Addr, unsigned Idx0, unsigned Idx1, const llvm::Twine &Name) { const llvm::DataLayout &DL = BB->getDataLayout(); -llvm::GetElementPtrInst *

[clang] [Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #130990)

2025-04-05 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130990 >From 48f8e2591c317f90eff6f1d0a4ecdf27e19a1b01 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 13 Mar 2025 00:39:09 +0800 Subject: [PATCH 1/5] [Clang][CodeGen][UBSan] Add pre-commit tests. NFC. --- cla

[clang] [Clang][CodeGen][UBSan] Add more precise attributes to recoverable ubsan handlers (PR #130990)

2025-04-05 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited https://github.com/llvm/llvm-project/pull/130990 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang][CodeGen] Respect -fwrapv-pointer when emitting struct GEPs (PR #134269)

2025-04-04 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > > most of them are safe > > What's the distinguishing factor here? Do you consider it "safe" to mark > inbounds if the pointer is immediately dereferenced? Or does the pointer have > to refer to a known successful allocation? Or something else? Other calls to `CGBuilderTy::Cr

  1   2   3   4   5   6   7   >