[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] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

2025-02-17 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/127525 Close https://github.com/llvm/llvm-project/issues/127475 >From d931667e3b7e18f8ba6f054405ffc5fe2fac36b4 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 18 Feb 2025 01:26:26 +0800 Subject: [PATCH] [Clang

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

2025-02-18 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/127525 >From d931667e3b7e18f8ba6f054405ffc5fe2fac36b4 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 18 Feb 2025 01:26:26 +0800 Subject: [PATCH 1/2] [Clang][CodeGen] Bail out on constexpr unknown values in Co

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

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

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

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

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

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

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

2025-03-04 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: Closed in favor of https://github.com/llvm/llvm-project/pull/128409 https://github.com/llvm/llvm-project/pull/127525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Treat constexpr-unknown value as invalid in `EvaluateAsInitializer` (PR #128409)

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

[clang] [flang] [lldb] [llvm] [mlir] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw approved this pull request. LGTM. Thank you! https://github.com/llvm/llvm-project/pull/129868 ___ 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-03-11 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw edited 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] [Clang][CodeGen] Do not set inbounds flag for struct GEP with null base pointers (PR #130734)

2025-03-11 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/130734 In the LLVM middle-end we want to fold `gep inbounds null, idx -> null`: https://alive2.llvm.org/ce/z/5ZkPx- This pattern is common in real-world programs. Generally, it exists in some (actually) unreachable bl

[clang] [Clang] Treat constexpr-unknown value as invalid in `EvaluateAsInitializer` (PR #128409)

2025-02-26 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/128409 >From 83248eb164ff53442ad6d0c9d1be20027519bac1 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 18 Feb 2025 01:26:26 +0800 Subject: [PATCH 1/6] [Clang][CodeGen] Bail out on constexpr unknown values in Co

[clang] [Clang] Treat constexpr-unknown value as invalid in `EvaluateAsInitializer` (PR #128409)

2025-02-26 Thread Yingwei Zheng via cfe-commits
@@ -17000,6 +16998,18 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx, if (!Info.discardCleanups()) llvm_unreachable("Unhandled cleanup; missing full expression marker?"); + +if (Value.allowConstexprUnknown()) { + assert(Value.isLV

[clang] [Clang] Treat constexpr-unknown value as invalid in `EvaluateAsInitializer` (PR #128409)

2025-03-01 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > If I am reading the code correctly there should be some constexpr cases that > generate a diagnostic, can we verify that with a test? It has been tested by the following case: ``` extern int &Recurse1; int &Recurse2 = Recurse1; int &Recurse1 = Recurse2; constexpr int &Recurse3

[clang] [flang] [llvm] [mlir] [TargetRegistry] Accept Triple in createTargetMachine() (NFC) (PR #130940)

2025-03-12 Thread Yingwei Zheng via cfe-commits
@@ -93,7 +93,7 @@ LLVMState::LLVMState(std::unique_ptr TM, std::unique_ptr LLVMState::createTargetMachine() const { return std::unique_ptr( TheTargetMachine->getTarget().createTargetMachine( - TheTargetMachine->getTargetTriple().normalize(), + Triple(T

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

2025-03-12 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > I'd still prefer to get this right for all address-spaces, so we don't need > to revisit later. Sentinel pointer value support for non-0 address spaces is still work in progress: https://github.com/llvm/llvm-project/pull/83109 I am ok to add a helper like `Address::isConstant

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -189,8 +190,10 @@ class LLVM_ABI Module { std::string ModuleID; ///< Human readable identifier for the module std::string SourceFileName; ///< Original source file name for module, ///< recorded in bitcode. - std::string T

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: Please fix MLIR build failure. https://github.com/llvm/llvm-project/pull/129868 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -79,7 +79,7 @@ SPIRVTranslate(Module *M, std::string &SpirvObj, std::string &ErrMsg, if (TargetTriple.getTriple().empty()) { TargetTriple.setTriple(DefaultTriple); -M->setTargetTriple(DefaultTriple); +M->setTargetTriple(Triple(DefaultTriple)); ---

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -139,7 +139,7 @@ class Lint : public InstVisitor { Lint(Module *Mod, const DataLayout *DL, AliasAnalysis *AA, AssumptionCache *AC, DominatorTree *DT, TargetLibraryInfo *TLI) - : Mod(Mod), TT(Triple::normalize(Mod->getTargetTriple())), DL(DL), AA(AA), + :

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -91,7 +91,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { } // Set up the module to build for our target. - M->setTargetTriple(TM->getTargetTriple().normalize()); + M->setTargetTriple(Triple(TM->getTargetTriple().normalize()));

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -124,7 +124,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { // Set up target dependant options // - M->setTargetTriple(TM->getTargetTriple().normalize()); + M->setTargetTriple(Triple(TM->getTargetTriple().normalize()));

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -114,7 +114,8 @@ std::unique_ptr llvm::parseInputFile(StringRef Filename, TargetTriple.setTriple(TheTriple.getTriple()); } - Result->setTargetTriple(TargetTriple.getTriple()); // override the triple + // override the triple + Result->setTargetTriple(Triple(TargetT

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -515,12 +515,13 @@ static void splitCodeGen(const Config &C, TargetMachine *TM, static Expected initAndLookupTarget(const Config &C, Module &Mod) { if (!C.OverrideTriple.empty()) -Mod.setTargetTriple(C.OverrideTriple

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -200,7 +200,7 @@ LTOModule::makeLTOModule(MemoryBufferRef Buffer, const TargetOptions &options, return EC; std::unique_ptr &M = *MOrErr; - std::string TripleStr = M->getTargetTriple(); + std::string TripleStr = M->getTargetTriple().str(); dtcxzyw w

[clang] [llvm] [polly] [IR] Store Triple in Module (NFC) (PR #129868)

2025-03-05 Thread Yingwei Zheng via cfe-commits
@@ -153,7 +153,7 @@ struct VerifierSupport { bool TreatBrokenDebugInfoAsError = true; explicit VerifierSupport(raw_ostream *OS, const Module &M) - : OS(OS), M(M), MST(&M), TT(Triple::normalize(M.getTargetTriple())), + : OS(OS), M(M), MST(&M), TT(M.getTargetTriple

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

2025-03-12 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/130990 Closes https://github.com/llvm/llvm-project/issues/130093. >From ea0d82d48d7a28467dc4e945314b57bc2b63085c Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Thu, 13 Mar 2025 00:39:09 +0800 Subject: [PATCH 1/2]

[clang] [flang] [llvm] [mlir] [TargetRegistry] Accept Triple in createTargetMachine() (NFC) (PR #130940)

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

[clang] [llvm] [CVP] Infer `nuw`/`nsw` flags for TruncInst (PR #130504)

2025-03-12 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw approved this pull request. LGTM. Thank you! https://github.com/llvm/llvm-project/pull/130504 ___ 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-03-12 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/130952 See also https://github.com/llvm/llvm-project/pull/130734 for the original motivation. This pattern (`container_of`) is also widely used by real-world programs. Examples: https://github.com/llvm/llvm-project/bl

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

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

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

2025-03-13 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > this check needs to happen at a higher level. And at that level, you should > have an Expr*, not just an Address. I tried to use `Expr::isNullPointerConstant` in `CodeGenFunction::EmitMemberExpr`: https://github.com/llvm/llvm-project/blob/59fd2878fce470f02058f43d4b818ed68ce040

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

2025-02-20 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/127525 >From d931667e3b7e18f8ba6f054405ffc5fe2fac36b4 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 18 Feb 2025 01:26:26 +0800 Subject: [PATCH 1/3] [Clang][CodeGen] Bail out on constexpr unknown values in Co

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

2025-02-20 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > Does it even make sense for evaluateValue to return a constexpr-unknown > value? If I'm following correctly, we can't actually do anything useful with > such a result: we don't actually know what the value is. It would make things > simpler if we kept such APValues as an inter

[clang] [Clang] Treat constexpr-unknown value as invalid in `evaluateValue` (PR #128409)

2025-02-23 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/128409 It is an alternative to https://github.com/llvm/llvm-project/pull/127525. Close https://github.com/llvm/llvm-project/issues/127475. >From 83248eb164ff53442ad6d0c9d1be20027519bac1 Mon Sep 17 00:00:00 2001 From:

[clang] [Clang] Treat constexpr-unknown value as invalid in `evaluateValue` (PR #128409)

2025-02-23 Thread Yingwei Zheng via cfe-commits
@@ -122,9 +122,9 @@ namespace CaseStatements { } extern int &Recurse1; -int &Recurse2 = Recurse1; // expected-note {{declared here}} +int &Recurse2 = Recurse1; // pre-cxx23-note {{declared here}} dtcxzyw wrote: This is a regression. https://github.com/llvm/l

[clang] [Clang][CodeGen] Bail out on constexpr unknown values in ConstantEmitter (PR #127525)

2025-02-23 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > > Clang rejects the following case after modifying evaluateValue to treat > > constexpr-unknown value as invalid > > I don't see the connection. At least, there isn't any obvious connection: the > testcase doesn't require constexpr-unknown. Maybe you need to "reject" the > va

[clang] [Clang] Treat constexpr-unknown value as invalid in `evaluateValue` (PR #128409)

2025-02-26 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/128409 >From 83248eb164ff53442ad6d0c9d1be20027519bac1 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 18 Feb 2025 01:26:26 +0800 Subject: [PATCH 1/5] [Clang][CodeGen] Bail out on constexpr unknown values in Co

[clang] [Clang] Treat constexpr-unknown value as invalid in `EvaluateAsInitializer` (PR #128409)

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

[clang] [Clang] Treat constexpr-unknown value as invalid in `evaluateValue` (PR #128409)

2025-02-26 Thread Yingwei Zheng via cfe-commits
@@ -17000,6 +16998,18 @@ bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx, if (!Info.discardCleanups()) llvm_unreachable("Unhandled cleanup; missing full expression marker?"); + +if (Value.allowConstexprUnknown()) { + assert(Value.isLV

[clang] [Clang] Treat constexpr-unknown value as invalid in `EvaluateAsInitializer` (PR #128409)

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

[clang] [Clang] Treat constexpr-unknown value as invalid in `EvaluateAsInitializer` (PR #128409)

2025-02-26 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > Should the other Expr::Evaluate* entry points have the same bailout? Do you > want to do that in this patch, or a followup? Sorry I don't have enough bandwidth to work on other potential constexpr-unknown-related issues. I just want to close https://github.com/llvm/llvm-proje

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

2025-03-31 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130734 >From 173ba1595cef80e2affd3ed57feabb2feb0856a7 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 11 Mar 2025 16:20:08 +0800 Subject: [PATCH 01/11] [Clang][CodeGen] Do not set inbounds flag for struct GEP

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

2025-03-31 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] Do not use the GEP result to infer offset and result type (PR #134221)

2025-04-03 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/134221 If `CreateConstInBoundsGEP2_32` returns a constant null/gep, the cast to GetElementPtrInst will fail. This patch uses two static helpers `GEPOperator::accumulateConstantOffset/GetElementPtrInst::getIndexedType`

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

2025-04-04 Thread Yingwei Zheng via cfe-commits
dtcxzyw wrote: > Usually we'd want to also insert `-fsanitize=pointer-overflow` > instrumentation in places where we respect `-fwrapv-pointer`. I'm not > entirely sure whether we want to do this here, as it will probably blow up > the amount of inserted instrumentation for little benefit... A

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

2025-04-04 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw updated https://github.com/llvm/llvm-project/pull/130734 >From b9876822acdca4eaea6496a1d6471e2c0f4ad2e1 Mon Sep 17 00:00:00 2001 From: Yingwei Zheng Date: Tue, 11 Mar 2025 16:20:08 +0800 Subject: [PATCH 1/8] [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-03-22 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/3] [Clang][CodeGen][UBSan] Add pre-commit tests. NFC. --- cla

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

2025-04-03 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw created https://github.com/llvm/llvm-project/pull/134269 This patch turns off inbounds/nuw flags for member accesses when `-fwrapv-pointer` is set. Note: There are many calls to `CGBuilderTy::CreateStructGEP`, and most of them are safe. So I think it is probably over

[clang] [Clang][CodeGen] Do not use the GEP result to infer offset and result type (PR #134221)

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

[clang] [Clang][CodeGen] Do not use the GEP result to infer offset and result type (PR #134221)

2025-04-03 Thread Yingwei Zheng via cfe-commits
https://github.com/dtcxzyw closed https://github.com/llvm/llvm-project/pull/134221 ___ 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

[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-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] 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] [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] [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
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
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] [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-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-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] [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

<    2   3   4   5   6   7