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

2024-12-06 Thread Florian Hahn via llvm-branch-commits


@@ -1441,8 +1441,10 @@ collectSanitizerRuntimes(const ToolChain &TC, const 
ArgList &Args,
 if (SanArgs.needsScudoRt()) {
   SharedRuntimes.push_back("scudo_standalone");
 }
-if (SanArgs.needsTsanRt())
+if (SanArgs.needsTsanRt() && SanArgs.linkRuntimes())

fhahn wrote:

Nope, I think this was left over from a merge, removed, thanks!

https://github.com/llvm/llvm-project/pull/76260
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


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

2024-12-06 Thread Florian Hahn via llvm-branch-commits

https://github.com/fhahn commented:

> LGTM with comments addressed. (I haven't looked carefully at the non-clang 
> parts; this is just approval for the clang changes.)


Thanks! Any chance you would be able to help with the review of the LLVM side 
as well? https://github.com/llvm/llvm-project/pull/76259

https://github.com/llvm/llvm-project/pull/76260
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


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

2024-12-06 Thread Florian Hahn via llvm-branch-commits


@@ -1441,8 +1441,10 @@ collectSanitizerRuntimes(const ToolChain &TC, const 
ArgList &Args,
 if (SanArgs.needsScudoRt()) {
   SharedRuntimes.push_back("scudo_standalone");
 }
-if (SanArgs.needsTsanRt())
+if (SanArgs.needsTsanRt() && SanArgs.linkRuntimes())
   SharedRuntimes.push_back("tsan");
+if (SanArgs.needsTysanRt())
+  StaticRuntimes.push_back("tysan");

fhahn wrote:

Fixed, thanks!

https://github.com/llvm/llvm-project/pull/76260
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


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

2024-12-06 Thread Florian Hahn via llvm-branch-commits

https://github.com/fhahn edited https://github.com/llvm/llvm-project/pull/76260
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CodeGen][PM] Initialize analyses with isAnalysis=true (PR #118779)

2024-12-06 Thread Akshat Oke via llvm-branch-commits

https://github.com/optimisan updated 
https://github.com/llvm/llvm-project/pull/118779

>From d48e889915d463cc32f6c5d3e6ce788fb7f44cea Mon Sep 17 00:00:00 2001
From: Akshat Oke 
Date: Thu, 5 Dec 2024 10:05:30 +
Subject: [PATCH 1/2] [CodeGen][PM] Initialize analyses with isAnalysis=true

Analyses should be marked as analyses else they are prone to be ignored
by the legacy analysis cache mechanism and get scheduled redundantly.
---
 llvm/lib/CodeGen/GCMetadata.cpp| 2 +-
 llvm/lib/CodeGen/LiveDebugVariables.cpp| 2 +-
 llvm/lib/CodeGen/LiveIntervals.cpp | 2 +-
 llvm/lib/CodeGen/LiveRegMatrix.cpp | 2 +-
 llvm/lib/CodeGen/LiveStacks.cpp| 2 +-
 llvm/lib/CodeGen/SlotIndexes.cpp   | 2 +-
 llvm/lib/CodeGen/VirtRegMap.cpp| 2 +-
 llvm/lib/Transforms/Utils/LoopSimplify.cpp | 4 ++--
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/CodeGen/GCMetadata.cpp b/llvm/lib/CodeGen/GCMetadata.cpp
index 6d1cc1a58e27df..f33008c9e0f232 100644
--- a/llvm/lib/CodeGen/GCMetadata.cpp
+++ b/llvm/lib/CodeGen/GCMetadata.cpp
@@ -66,7 +66,7 @@ GCFunctionAnalysis::run(Function &F, FunctionAnalysisManager 
&FAM) {
 }
 
 INITIALIZE_PASS(GCModuleInfo, "collector-metadata",
-"Create Garbage Collector Module Metadata", false, false)
+"Create Garbage Collector Module Metadata", false, true)
 
 // 
-
 
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp 
b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 317d3401f000a4..79085e587ebc45 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -82,7 +82,7 @@ INITIALIZE_PASS_BEGIN(LiveDebugVariablesWrapperLegacy, 
DEBUG_TYPE,
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
 INITIALIZE_PASS_END(LiveDebugVariablesWrapperLegacy, DEBUG_TYPE,
-"Debug Variable Analysis", false, false)
+"Debug Variable Analysis", false, true)
 
 void LiveDebugVariablesWrapperLegacy::getAnalysisUsage(
 AnalysisUsage &AU) const {
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp 
b/llvm/lib/CodeGen/LiveIntervals.cpp
index f9ee6e4563f8d6..f38527a3ce6a31 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.cpp
@@ -83,7 +83,7 @@ INITIALIZE_PASS_BEGIN(LiveIntervalsWrapperPass, 
"liveintervals",
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
 INITIALIZE_PASS_END(LiveIntervalsWrapperPass, "liveintervals",
-"Live Interval Analysis", false, false)
+"Live Interval Analysis", false, true)
 
 bool LiveIntervalsWrapperPass::runOnMachineFunction(MachineFunction &MF) {
   LIS.Indexes = &getAnalysis().getSI();
diff --git a/llvm/lib/CodeGen/LiveRegMatrix.cpp 
b/llvm/lib/CodeGen/LiveRegMatrix.cpp
index bc8c59381a40e1..9744c47d5a8510 100644
--- a/llvm/lib/CodeGen/LiveRegMatrix.cpp
+++ b/llvm/lib/CodeGen/LiveRegMatrix.cpp
@@ -41,7 +41,7 @@ INITIALIZE_PASS_BEGIN(LiveRegMatrixWrapperLegacy, 
"liveregmatrix",
 INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(VirtRegMapWrapperLegacy)
 INITIALIZE_PASS_END(LiveRegMatrixWrapperLegacy, "liveregmatrix",
-"Live Register Matrix", false, false)
+"Live Register Matrix", false, true)
 
 void LiveRegMatrixWrapperLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
diff --git a/llvm/lib/CodeGen/LiveStacks.cpp b/llvm/lib/CodeGen/LiveStacks.cpp
index 92cc6699f2d331..d615caf48c0ad3 100644
--- a/llvm/lib/CodeGen/LiveStacks.cpp
+++ b/llvm/lib/CodeGen/LiveStacks.cpp
@@ -25,7 +25,7 @@ INITIALIZE_PASS_BEGIN(LiveStacksWrapperLegacy, DEBUG_TYPE,
   "Live Stack Slot Analysis", false, false)
 INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
 INITIALIZE_PASS_END(LiveStacksWrapperLegacy, DEBUG_TYPE,
-"Live Stack Slot Analysis", false, false)
+"Live Stack Slot Analysis", false, true)
 
 char &llvm::LiveStacksID = LiveStacksWrapperLegacy::ID;
 
diff --git a/llvm/lib/CodeGen/SlotIndexes.cpp b/llvm/lib/CodeGen/SlotIndexes.cpp
index 1b92a5aa59d18c..8d2832b3fdd56e 100644
--- a/llvm/lib/CodeGen/SlotIndexes.cpp
+++ b/llvm/lib/CodeGen/SlotIndexes.cpp
@@ -45,7 +45,7 @@ SlotIndexes::~SlotIndexes() {
 }
 
 INITIALIZE_PASS(SlotIndexesWrapperPass, DEBUG_TYPE, "Slot index numbering",
-false, false)
+false, true)
 
 STATISTIC(NumLocalRenum,  "Number of local renumberings");
 
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 1352102a93d01b..b28c74600e7a29 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -60,7 +60,7 @@ STATISTIC(NumIdCopies,   "Number of identity moves eliminated 
after rewriting");
 char

[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

2024-12-06 Thread Ilya Biryukov via llvm-branch-commits

ilya-biryukov wrote:

> So the meaning of stacked PR in this series of patches is pretty 
> questionable. So I feel it is better to merge these PRs into a single commit 
> so that it is easier to be cherry-picked and reverted in my experience

+100, this is definitely the right call.
... and I wish we had a better way to do stacked PRs, this is definitely one of 
the downgrades compared to Phabricator. 

https://github.com/llvm/llvm-project/pull/83237
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [CodeGen][PM] Initialize analyses with isAnalysis=true (PR #118779)

2024-12-06 Thread Akshat Oke via llvm-branch-commits

https://github.com/optimisan updated 
https://github.com/llvm/llvm-project/pull/118779

>From d48e889915d463cc32f6c5d3e6ce788fb7f44cea Mon Sep 17 00:00:00 2001
From: Akshat Oke 
Date: Thu, 5 Dec 2024 10:05:30 +
Subject: [PATCH 1/2] [CodeGen][PM] Initialize analyses with isAnalysis=true

Analyses should be marked as analyses else they are prone to be ignored
by the legacy analysis cache mechanism and get scheduled redundantly.
---
 llvm/lib/CodeGen/GCMetadata.cpp| 2 +-
 llvm/lib/CodeGen/LiveDebugVariables.cpp| 2 +-
 llvm/lib/CodeGen/LiveIntervals.cpp | 2 +-
 llvm/lib/CodeGen/LiveRegMatrix.cpp | 2 +-
 llvm/lib/CodeGen/LiveStacks.cpp| 2 +-
 llvm/lib/CodeGen/SlotIndexes.cpp   | 2 +-
 llvm/lib/CodeGen/VirtRegMap.cpp| 2 +-
 llvm/lib/Transforms/Utils/LoopSimplify.cpp | 4 ++--
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/llvm/lib/CodeGen/GCMetadata.cpp b/llvm/lib/CodeGen/GCMetadata.cpp
index 6d1cc1a58e27df..f33008c9e0f232 100644
--- a/llvm/lib/CodeGen/GCMetadata.cpp
+++ b/llvm/lib/CodeGen/GCMetadata.cpp
@@ -66,7 +66,7 @@ GCFunctionAnalysis::run(Function &F, FunctionAnalysisManager 
&FAM) {
 }
 
 INITIALIZE_PASS(GCModuleInfo, "collector-metadata",
-"Create Garbage Collector Module Metadata", false, false)
+"Create Garbage Collector Module Metadata", false, true)
 
 // 
-
 
diff --git a/llvm/lib/CodeGen/LiveDebugVariables.cpp 
b/llvm/lib/CodeGen/LiveDebugVariables.cpp
index 317d3401f000a4..79085e587ebc45 100644
--- a/llvm/lib/CodeGen/LiveDebugVariables.cpp
+++ b/llvm/lib/CodeGen/LiveDebugVariables.cpp
@@ -82,7 +82,7 @@ INITIALIZE_PASS_BEGIN(LiveDebugVariablesWrapperLegacy, 
DEBUG_TYPE,
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
 INITIALIZE_PASS_END(LiveDebugVariablesWrapperLegacy, DEBUG_TYPE,
-"Debug Variable Analysis", false, false)
+"Debug Variable Analysis", false, true)
 
 void LiveDebugVariablesWrapperLegacy::getAnalysisUsage(
 AnalysisUsage &AU) const {
diff --git a/llvm/lib/CodeGen/LiveIntervals.cpp 
b/llvm/lib/CodeGen/LiveIntervals.cpp
index f9ee6e4563f8d6..f38527a3ce6a31 100644
--- a/llvm/lib/CodeGen/LiveIntervals.cpp
+++ b/llvm/lib/CodeGen/LiveIntervals.cpp
@@ -83,7 +83,7 @@ INITIALIZE_PASS_BEGIN(LiveIntervalsWrapperPass, 
"liveintervals",
 INITIALIZE_PASS_DEPENDENCY(MachineDominatorTreeWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
 INITIALIZE_PASS_END(LiveIntervalsWrapperPass, "liveintervals",
-"Live Interval Analysis", false, false)
+"Live Interval Analysis", false, true)
 
 bool LiveIntervalsWrapperPass::runOnMachineFunction(MachineFunction &MF) {
   LIS.Indexes = &getAnalysis().getSI();
diff --git a/llvm/lib/CodeGen/LiveRegMatrix.cpp 
b/llvm/lib/CodeGen/LiveRegMatrix.cpp
index bc8c59381a40e1..9744c47d5a8510 100644
--- a/llvm/lib/CodeGen/LiveRegMatrix.cpp
+++ b/llvm/lib/CodeGen/LiveRegMatrix.cpp
@@ -41,7 +41,7 @@ INITIALIZE_PASS_BEGIN(LiveRegMatrixWrapperLegacy, 
"liveregmatrix",
 INITIALIZE_PASS_DEPENDENCY(LiveIntervalsWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(VirtRegMapWrapperLegacy)
 INITIALIZE_PASS_END(LiveRegMatrixWrapperLegacy, "liveregmatrix",
-"Live Register Matrix", false, false)
+"Live Register Matrix", false, true)
 
 void LiveRegMatrixWrapperLegacy::getAnalysisUsage(AnalysisUsage &AU) const {
   AU.setPreservesAll();
diff --git a/llvm/lib/CodeGen/LiveStacks.cpp b/llvm/lib/CodeGen/LiveStacks.cpp
index 92cc6699f2d331..d615caf48c0ad3 100644
--- a/llvm/lib/CodeGen/LiveStacks.cpp
+++ b/llvm/lib/CodeGen/LiveStacks.cpp
@@ -25,7 +25,7 @@ INITIALIZE_PASS_BEGIN(LiveStacksWrapperLegacy, DEBUG_TYPE,
   "Live Stack Slot Analysis", false, false)
 INITIALIZE_PASS_DEPENDENCY(SlotIndexesWrapperPass)
 INITIALIZE_PASS_END(LiveStacksWrapperLegacy, DEBUG_TYPE,
-"Live Stack Slot Analysis", false, false)
+"Live Stack Slot Analysis", false, true)
 
 char &llvm::LiveStacksID = LiveStacksWrapperLegacy::ID;
 
diff --git a/llvm/lib/CodeGen/SlotIndexes.cpp b/llvm/lib/CodeGen/SlotIndexes.cpp
index 1b92a5aa59d18c..8d2832b3fdd56e 100644
--- a/llvm/lib/CodeGen/SlotIndexes.cpp
+++ b/llvm/lib/CodeGen/SlotIndexes.cpp
@@ -45,7 +45,7 @@ SlotIndexes::~SlotIndexes() {
 }
 
 INITIALIZE_PASS(SlotIndexesWrapperPass, DEBUG_TYPE, "Slot index numbering",
-false, false)
+false, true)
 
 STATISTIC(NumLocalRenum,  "Number of local renumberings");
 
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 1352102a93d01b..b28c74600e7a29 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -60,7 +60,7 @@ STATISTIC(NumIdCopies,   "Number of identity moves eliminated 
after rewriting");
 char

[llvm-branch-commits] [llvm] [CodeGen][PM] Initialize analyses with isAnalysis=true (PR #118779)

2024-12-06 Thread Akshat Oke via llvm-branch-commits

optimisan wrote:

### Merge activity

* **Dec 6, 4:43 AM EST**: A user started a stack merge that includes this pull 
request via 
[Graphite](https://app.graphite.dev/github/pr/llvm/llvm-project/118779).


https://github.com/llvm/llvm-project/pull/118779
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=flang-rt (PR #110217)

2024-12-06 Thread Michael Kruse via llvm-branch-commits

Meinersbur wrote:

As @jeanPerier correctly pointed out to me, some buildbots would start failing 
with this patch, at least those running the Test-Suite using Flang will fail 
since the runtime is needed to correctly exectute applications, but also two 
builders that build the runtime out-of-tree will fail. I prepared a llvm-zorg 
patch to adapt the build configurations: 
https://github.com/llvm/llvm-zorg/pull/333.

Once this PR are accepted, I would wait for feedback from buildbots before 
applying the llvm-zorg patch in order to have a chance to revert if any 
`check-flang` steps are failing. After 
https://github.com/llvm/llvm-zorg/pull/333 @gkistanova needs to restart the 
[buildbot](https://lab.llvm.org/buildbot), so some intermittent buildbot 
failures seem unavoidable anyway. I also cannot test 
https://github.com/llvm/llvm-zorg/pull/333 in advance, so some more updates may 
be required, possibly by the worker's owners.

https://github.com/llvm/llvm-project/pull/110217
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [NFC][Utils] Extract BuildDebugInfoMDMap from CloneFunctionInto (PR #118622)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits


@@ -79,14 +79,16 @@ struct ValueMapConfig {
   static mutex_type *getMutex(const ExtraDataT &/*Data*/) { return nullptr; }
 };
 
+/// This type stores Metadata. Used in ValueMap.
+using MDMapT = DenseMap;

artempyanykh wrote:

@felipepiovezan good call! Let me just spell out the type completely.

https://github.com/llvm/llvm-project/pull/118622
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [NFC][Utils] Extract BuildDebugInfoMDMap from CloneFunctionInto (PR #118622)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118622
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [NFC][Utils] Extract CloneFunctionMetadataInto from CloneFunctionInto (PR #118623)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118623
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [NFC][Utils] Eliminate DISubprogram set from BuildDebugInfoMDMap (PR #118625)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118625
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [Utils] Identity map global debug info on first use in CloneFunction* (PR #118627)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118627
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [Coro] Prebuild a global debug info set and share it between all coroutine clones (PR #118628)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118628
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [NFC][Utils] Extract CloneFunctionBodyInto from CloneFunctionInto (PR #118624)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118624
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [Coro] Use DebugInfoCache to speed up cloning in CoroSplitPass (PR #118630)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118630
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [Analysis] Add DebugInfoCache analysis (PR #118629)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh edited 
https://github.com/llvm/llvm-project/pull/118629
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

2024-12-06 Thread Dmitry Vasilyev via llvm-branch-commits

slydiman wrote:

[Commit 
b5bd192](https://github.com/llvm/llvm-project/commit/b5bd1928c6d43bc525a4e3fb65d2c750d61e)
 break buildbots
https://lab.llvm.org/buildbot/#/builders/195/builds/1985
https://lab.llvm.org/staging/#/builders/197/builds/1161



https://github.com/llvm/llvm-project/pull/83237
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] 0320d20 - Revert "[Clang] Deleting an incomplete enum type is not an error (#118455)"

2024-12-06 Thread via llvm-branch-commits

Author: cor3ntin
Date: 2024-12-06T15:16:34+01:00
New Revision: 0320d20dbdcafec2a090006c9674f642e207db27

URL: 
https://github.com/llvm/llvm-project/commit/0320d20dbdcafec2a090006c9674f642e207db27
DIFF: 
https://github.com/llvm/llvm-project/commit/0320d20dbdcafec2a090006c9674f642e207db27.diff

LOG: Revert "[Clang] Deleting an incomplete enum type is not an error (#118455)"

This reverts commit 8271195de05742ed7079d7882fbebc2daecbd7e2.

Added: 


Modified: 
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaExprCXX.cpp
clang/test/SemaCXX/new-delete.cpp

Removed: 




diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 3f58e64cf0ccbc..59e3a6609123d2 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -796,7 +796,6 @@ Bug Fixes to C++ Support
 - Fixed an assertion failure caused by mangled names with invalid identifiers. 
(#GH112205)
 - Fixed an incorrect lambda scope of generic lambdas that caused Clang to 
crash when computing potential lambda
   captures at the end of a full expression. (#GH115931)
-- Clang no longer rejects deleting a pointer of incomplete enumeration type. 
(#GH99278)
 
 Bug Fixes to AST Handling
 ^

diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index db9ea7fb66e05a..f58c0fa21e8380 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -3747,8 +3747,7 @@ Sema::ActOnCXXDelete(SourceLocation StartLoc, bool 
UseGlobal,
 } else if (!Pointee->isDependentType()) {
   // FIXME: This can result in errors if the definition was imported from a
   // module but is hidden.
-  if (!Pointee->isStructureOrClassType() ||
-  !RequireCompleteType(StartLoc, Pointee,
+  if (!RequireCompleteType(StartLoc, Pointee,
LangOpts.CPlusPlus26
? diag::err_delete_incomplete
: diag::warn_delete_incomplete,

diff  --git a/clang/test/SemaCXX/new-delete.cpp 
b/clang/test/SemaCXX/new-delete.cpp
index 98b168d9df1f37..595bdc689d694b 100644
--- a/clang/test/SemaCXX/new-delete.cpp
+++ b/clang/test/SemaCXX/new-delete.cpp
@@ -540,13 +540,6 @@ namespace PR10504 {
   void f(A *x) { delete x; } // expected-warning {{delete called on 
'PR10504::A' that is abstract but has non-virtual destructor}}
 }
 
-#if __cplusplus >= 201103L
-enum GH99278_1 {
-zero = decltype(delete static_cast(nullptr), 0){}
-// expected-warning@-1 {{expression with side effects has no effect in an 
unevaluated context}}
-};
-#endif
-
 struct PlacementArg {};
 inline void *operator new[](size_t, const PlacementArg &) throw () {
   return 0;



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [NFC] Remove adhoc definition of MDMapT in IRMover (PR #118626)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

artempyanykh wrote:

Abandoned due to a change in #118622.

https://github.com/llvm/llvm-project/pull/118626
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [NFC] Remove adhoc definition of MDMapT in IRMover (PR #118626)

2024-12-06 Thread Artem Pianykh via llvm-branch-commits

https://github.com/artempyanykh closed 
https://github.com/llvm/llvm-project/pull/118626
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][cuda] Handle gpu.return in AbstractResult pass (PR #119035)

2024-12-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-flang-fir-hlfir

Author: Valentin Clement (バレンタイン クレメン) (clementval)


Changes

Process `gpu.return` in AbstractResult pass when the function is a `gpu.func`. 

---
Full diff: https://github.com/llvm/llvm-project/pull/119035.diff


2 Files Affected:

- (modified) flang/lib/Optimizer/Transforms/AbstractResult.cpp (+74-49) 
- (added) flang/test/Fir/CUDA/cuda-abstract-result.mlir (+37) 


``diff
diff --git a/flang/lib/Optimizer/Transforms/AbstractResult.cpp 
b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
index 2ed66cc83eefb5..b0327cc10e9de6 100644
--- a/flang/lib/Optimizer/Transforms/AbstractResult.cpp
+++ b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
@@ -234,6 +234,60 @@ class SaveResultOpConversion
   }
 };
 
+template 
+static mlir::LogicalResult
+processReturnLikeOp(OpTy ret, mlir::Value newArg,
+mlir::PatternRewriter &rewriter) {
+  auto loc = ret.getLoc();
+  rewriter.setInsertionPoint(ret);
+  mlir::Value resultValue = ret.getOperand(0);
+  fir::LoadOp resultLoad;
+  mlir::Value resultStorage;
+  // Identify result local storage.
+  if (auto load = resultValue.getDefiningOp()) {
+resultLoad = load;
+resultStorage = load.getMemref();
+// The result alloca may be behind a fir.declare, if any.
+if (auto declare = resultStorage.getDefiningOp())
+  resultStorage = declare.getMemref();
+  }
+  // Replace old local storage with new storage argument, unless
+  // the derived type is C_PTR/C_FUN_PTR, in which case the return
+  // type is updated to return void* (no new argument is passed).
+  if (fir::isa_builtin_cptr_type(resultValue.getType())) {
+auto module = ret->template getParentOfType();
+FirOpBuilder builder(rewriter, module);
+mlir::Value cptr = resultValue;
+if (resultLoad) {
+  // Replace whole derived type load by component load.
+  cptr = resultLoad.getMemref();
+  rewriter.setInsertionPoint(resultLoad);
+}
+mlir::Value newResultValue =
+fir::factory::genCPtrOrCFunptrValue(builder, loc, cptr);
+newResultValue = builder.createConvert(
+loc, getVoidPtrType(ret.getContext()), newResultValue);
+rewriter.setInsertionPoint(ret);
+rewriter.replaceOpWithNewOp(ret, mlir::ValueRange{newResultValue});
+  } else if (resultStorage) {
+resultStorage.replaceAllUsesWith(newArg);
+rewriter.replaceOpWithNewOp(ret);
+  } else {
+// The result storage may have been optimized out by a memory to
+// register pass, this is possible for fir.box results, or fir.record
+// with no length parameters. Simply store the result in the result
+// storage. at the return point.
+rewriter.create(loc, resultValue, newArg);
+rewriter.replaceOpWithNewOp(ret);
+  }
+  // Delete result old local storage if unused.
+  if (resultStorage)
+if (auto alloc = resultStorage.getDefiningOp())
+  if (alloc->use_empty())
+rewriter.eraseOp(alloc);
+  return mlir::success();
+}
+
 class ReturnOpConversion : public mlir::OpRewritePattern 
{
 public:
   using OpRewritePattern::OpRewritePattern;
@@ -242,55 +296,23 @@ class ReturnOpConversion : public 
mlir::OpRewritePattern {
   llvm::LogicalResult
   matchAndRewrite(mlir::func::ReturnOp ret,
   mlir::PatternRewriter &rewriter) const override {
-auto loc = ret.getLoc();
-rewriter.setInsertionPoint(ret);
-mlir::Value resultValue = ret.getOperand(0);
-fir::LoadOp resultLoad;
-mlir::Value resultStorage;
-// Identify result local storage.
-if (auto load = resultValue.getDefiningOp()) {
-  resultLoad = load;
-  resultStorage = load.getMemref();
-  // The result alloca may be behind a fir.declare, if any.
-  if (auto declare = resultStorage.getDefiningOp())
-resultStorage = declare.getMemref();
-}
-// Replace old local storage with new storage argument, unless
-// the derived type is C_PTR/C_FUN_PTR, in which case the return
-// type is updated to return void* (no new argument is passed).
-if (fir::isa_builtin_cptr_type(resultValue.getType())) {
-  auto module = ret->getParentOfType();
-  FirOpBuilder builder(rewriter, module);
-  mlir::Value cptr = resultValue;
-  if (resultLoad) {
-// Replace whole derived type load by component load.
-cptr = resultLoad.getMemref();
-rewriter.setInsertionPoint(resultLoad);
-  }
-  mlir::Value newResultValue =
-  fir::factory::genCPtrOrCFunptrValue(builder, loc, cptr);
-  newResultValue = builder.createConvert(
-  loc, getVoidPtrType(ret.getContext()), newResultValue);
-  rewriter.setInsertionPoint(ret);
-  rewriter.replaceOpWithNewOp(
-  ret, mlir::ValueRange{newResultValue});
-} else if (resultStorage) {
-  resultStorage.replaceAllUsesWith(newArg);
-  rewriter.replaceOpWithNewOp(ret);
-} else {
-  // The result storage may have been optimized out by a memory to
-  // reg

[llvm-branch-commits] [clang] [flang] [lld] [llvm] [Flang] LLVM_ENABLE_RUNTIMES=flang-rt (PR #110217)

2024-12-06 Thread Michael Kruse via llvm-branch-commits

Meinersbur wrote:

@h-vetinari I completed rebase and cleanup. Now would be a great time to have 
another look.

https://github.com/llvm/llvm-project/pull/110217
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [flang] [flang][cuda] Handle gpu.return in AbstractResult pass (PR #119035)

2024-12-06 Thread Valentin Clement バレンタイン クレメン via llvm-branch-commits

https://github.com/clementval created 
https://github.com/llvm/llvm-project/pull/119035

Process `gpu.return` in AbstractResult pass when the function is a `gpu.func`. 

>From 72a892909a7ce898423cea709f674956dc2121d1 Mon Sep 17 00:00:00 2001
From: Valentin Clement 
Date: Fri, 6 Dec 2024 13:42:06 -0800
Subject: [PATCH] [flang][cuda] Handle gpu.return in AbstractResult pass

---
 .../Optimizer/Transforms/AbstractResult.cpp   | 123 +++---
 flang/test/Fir/CUDA/cuda-abstract-result.mlir |  37 ++
 2 files changed, 111 insertions(+), 49 deletions(-)
 create mode 100644 flang/test/Fir/CUDA/cuda-abstract-result.mlir

diff --git a/flang/lib/Optimizer/Transforms/AbstractResult.cpp 
b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
index 2ed66cc83eefb5..b0327cc10e9de6 100644
--- a/flang/lib/Optimizer/Transforms/AbstractResult.cpp
+++ b/flang/lib/Optimizer/Transforms/AbstractResult.cpp
@@ -234,6 +234,60 @@ class SaveResultOpConversion
   }
 };
 
+template 
+static mlir::LogicalResult
+processReturnLikeOp(OpTy ret, mlir::Value newArg,
+mlir::PatternRewriter &rewriter) {
+  auto loc = ret.getLoc();
+  rewriter.setInsertionPoint(ret);
+  mlir::Value resultValue = ret.getOperand(0);
+  fir::LoadOp resultLoad;
+  mlir::Value resultStorage;
+  // Identify result local storage.
+  if (auto load = resultValue.getDefiningOp()) {
+resultLoad = load;
+resultStorage = load.getMemref();
+// The result alloca may be behind a fir.declare, if any.
+if (auto declare = resultStorage.getDefiningOp())
+  resultStorage = declare.getMemref();
+  }
+  // Replace old local storage with new storage argument, unless
+  // the derived type is C_PTR/C_FUN_PTR, in which case the return
+  // type is updated to return void* (no new argument is passed).
+  if (fir::isa_builtin_cptr_type(resultValue.getType())) {
+auto module = ret->template getParentOfType();
+FirOpBuilder builder(rewriter, module);
+mlir::Value cptr = resultValue;
+if (resultLoad) {
+  // Replace whole derived type load by component load.
+  cptr = resultLoad.getMemref();
+  rewriter.setInsertionPoint(resultLoad);
+}
+mlir::Value newResultValue =
+fir::factory::genCPtrOrCFunptrValue(builder, loc, cptr);
+newResultValue = builder.createConvert(
+loc, getVoidPtrType(ret.getContext()), newResultValue);
+rewriter.setInsertionPoint(ret);
+rewriter.replaceOpWithNewOp(ret, mlir::ValueRange{newResultValue});
+  } else if (resultStorage) {
+resultStorage.replaceAllUsesWith(newArg);
+rewriter.replaceOpWithNewOp(ret);
+  } else {
+// The result storage may have been optimized out by a memory to
+// register pass, this is possible for fir.box results, or fir.record
+// with no length parameters. Simply store the result in the result
+// storage. at the return point.
+rewriter.create(loc, resultValue, newArg);
+rewriter.replaceOpWithNewOp(ret);
+  }
+  // Delete result old local storage if unused.
+  if (resultStorage)
+if (auto alloc = resultStorage.getDefiningOp())
+  if (alloc->use_empty())
+rewriter.eraseOp(alloc);
+  return mlir::success();
+}
+
 class ReturnOpConversion : public mlir::OpRewritePattern 
{
 public:
   using OpRewritePattern::OpRewritePattern;
@@ -242,55 +296,23 @@ class ReturnOpConversion : public 
mlir::OpRewritePattern {
   llvm::LogicalResult
   matchAndRewrite(mlir::func::ReturnOp ret,
   mlir::PatternRewriter &rewriter) const override {
-auto loc = ret.getLoc();
-rewriter.setInsertionPoint(ret);
-mlir::Value resultValue = ret.getOperand(0);
-fir::LoadOp resultLoad;
-mlir::Value resultStorage;
-// Identify result local storage.
-if (auto load = resultValue.getDefiningOp()) {
-  resultLoad = load;
-  resultStorage = load.getMemref();
-  // The result alloca may be behind a fir.declare, if any.
-  if (auto declare = resultStorage.getDefiningOp())
-resultStorage = declare.getMemref();
-}
-// Replace old local storage with new storage argument, unless
-// the derived type is C_PTR/C_FUN_PTR, in which case the return
-// type is updated to return void* (no new argument is passed).
-if (fir::isa_builtin_cptr_type(resultValue.getType())) {
-  auto module = ret->getParentOfType();
-  FirOpBuilder builder(rewriter, module);
-  mlir::Value cptr = resultValue;
-  if (resultLoad) {
-// Replace whole derived type load by component load.
-cptr = resultLoad.getMemref();
-rewriter.setInsertionPoint(resultLoad);
-  }
-  mlir::Value newResultValue =
-  fir::factory::genCPtrOrCFunptrValue(builder, loc, cptr);
-  newResultValue = builder.createConvert(
-  loc, getVoidPtrType(ret.getContext()), newResultValue);
-  rewriter.setInsertionPoint(ret);
-  rewriter.replaceOpWithNewOp(
-  ret, mlir::ValueRange{newResultValue});
-} else if (resultStorage) {
-

[llvm-branch-commits] [flang] [flang][cuda] Handle gpu.return in AbstractResult pass (PR #119035)

2024-12-06 Thread Zhen Wang via llvm-branch-commits

https://github.com/wangzpgi approved this pull request.


https://github.com/llvm/llvm-project/pull/119035
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] [clang-tidy] fix false positive in lambda expr for return-const-ref-from-parameter (PR #118990)

2024-12-06 Thread Julian Schmidt via llvm-branch-commits

https://github.com/5chmidti approved this pull request.

Nice catch, LGTM

https://github.com/llvm/llvm-project/pull/118990
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] [clang-tidy] fix false positive in lambda expr for return-const-ref-from-parameter (PR #118990)

2024-12-06 Thread Congcong Cai via llvm-branch-commits

https://github.com/HerrCai0907 created 
https://github.com/llvm/llvm-project/pull/118990

None

>From 2fb6e21f63a16b5bde5401a4e1cb68af1405a258 Mon Sep 17 00:00:00 2001
From: Congcong Cai 
Date: Fri, 6 Dec 2024 23:45:56 +0800
Subject: [PATCH] [clang-tidy] fix false positive in lambda expr for
 return-const-ref-from-parameter

---
 .../ReturnConstRefFromParameterCheck.cpp  | 14 +--
 clang-tools-extra/docs/ReleaseNotes.rst   |  4 ++--
 .../return-const-ref-from-parameter.cpp   | 23 +++
 3 files changed, 31 insertions(+), 10 deletions(-)

diff --git 
a/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
index a35fcd99d494af..295955a971d7e8 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
@@ -31,22 +31,20 @@ void 
ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) {
  qualType(lValueReferenceType(pointee(
   qualType(isConstQualified()
  .bind("type"))),
- hasDeclContext(functionDecl().bind("owner")),
+ hasDeclContext(functionDecl(
+ equalsBoundNode("func"),
+ hasReturnTypeLoc(loc(qualType(
+ 
hasCanonicalType(equalsBoundNode("type"))),
  unless(hasLifetimeBoundAttr()))
  .bind("param")))
   .bind("dref"));
-  const auto Func =
-  functionDecl(equalsBoundNode("owner"),
-   hasReturnTypeLoc(loc(
-   qualType(hasCanonicalType(equalsBoundNode("type"))
-  .bind("func");
 
   Finder->addMatcher(
   returnStmt(
+  hasAncestor(functionDecl().bind("func")),
   hasReturnValue(anyOf(
   DRef, ignoringParens(conditionalOperator(eachOf(
-hasTrueExpression(DRef), hasFalseExpression(DRef)),
-  hasAncestor(Func)),
+hasTrueExpression(DRef), 
hasFalseExpression(DRef))),
   this);
 }
 
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index e00f86f7d01447..b2b66dca6ccf85 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -183,8 +183,8 @@ Changes in existing checks
 - Improved :doc:`bugprone-return-const-ref-from-parameter
   ` check to
   diagnose potential dangling references when returning a ``const &`` parameter
-  by using the conditional operator ``cond ? var1 : var2`` and no longer giving
-  false positives for functions which contain lambda and ignore parameters
+  by using the conditional operator ``cond ? var1 : var2`` and fixing false
+  positives for functions which contain lambda and ignore parameters
   with ``[[clang::lifetimebound]]`` attribute.
   
 - Improved :doc:`bugprone-sizeof-expression
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
index 46cb9063beda97..a3297ca0f8084e 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
@@ -203,3 +203,26 @@ namespace use_lifetime_bound_attr {
 int const &f(int const &a [[clang::lifetimebound]]) { return a; }
 } // namespace use_lifetime_bound_attr
 } // namespace gh117696
+
+
+namespace lambda {
+using T = const int &;
+using K = const float &;
+T inner_valid_lambda(T a) {
+  [&]() -> T { return a; };
+  return a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: returning a constant reference 
parameter
+}
+T inner_invalid_lambda(T a) {
+  [&](T a) -> T { return a; };
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: returning a constant reference 
parameter
+  return a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: returning a constant reference 
parameter
+}
+T inner_invalid_lambda2(T a) {
+  [&](K a) -> K { return a; };
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: returning a constant reference 
parameter
+  return a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: returning a constant reference 
parameter
+}
+} // namespace lambda

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] [clang-tidy] fix false positive in lambda expr for return-const-ref-from-parameter (PR #118990)

2024-12-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang-tidy

Author: Congcong Cai (HerrCai0907)


Changes



---
Full diff: https://github.com/llvm/llvm-project/pull/118990.diff


3 Files Affected:

- (modified) 
clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp 
(+6-8) 
- (modified) clang-tools-extra/docs/ReleaseNotes.rst (+2-2) 
- (modified) 
clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
 (+23) 


``diff
diff --git 
a/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp 
b/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
index a35fcd99d494af..295955a971d7e8 100644
--- a/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
+++ b/clang-tools-extra/clang-tidy/bugprone/ReturnConstRefFromParameterCheck.cpp
@@ -31,22 +31,20 @@ void 
ReturnConstRefFromParameterCheck::registerMatchers(MatchFinder *Finder) {
  qualType(lValueReferenceType(pointee(
   qualType(isConstQualified()
  .bind("type"))),
- hasDeclContext(functionDecl().bind("owner")),
+ hasDeclContext(functionDecl(
+ equalsBoundNode("func"),
+ hasReturnTypeLoc(loc(qualType(
+ 
hasCanonicalType(equalsBoundNode("type"))),
  unless(hasLifetimeBoundAttr()))
  .bind("param")))
   .bind("dref"));
-  const auto Func =
-  functionDecl(equalsBoundNode("owner"),
-   hasReturnTypeLoc(loc(
-   qualType(hasCanonicalType(equalsBoundNode("type"))
-  .bind("func");
 
   Finder->addMatcher(
   returnStmt(
+  hasAncestor(functionDecl().bind("func")),
   hasReturnValue(anyOf(
   DRef, ignoringParens(conditionalOperator(eachOf(
-hasTrueExpression(DRef), hasFalseExpression(DRef)),
-  hasAncestor(Func)),
+hasTrueExpression(DRef), 
hasFalseExpression(DRef))),
   this);
 }
 
diff --git a/clang-tools-extra/docs/ReleaseNotes.rst 
b/clang-tools-extra/docs/ReleaseNotes.rst
index e00f86f7d01447..b2b66dca6ccf85 100644
--- a/clang-tools-extra/docs/ReleaseNotes.rst
+++ b/clang-tools-extra/docs/ReleaseNotes.rst
@@ -183,8 +183,8 @@ Changes in existing checks
 - Improved :doc:`bugprone-return-const-ref-from-parameter
   ` check to
   diagnose potential dangling references when returning a ``const &`` parameter
-  by using the conditional operator ``cond ? var1 : var2`` and no longer giving
-  false positives for functions which contain lambda and ignore parameters
+  by using the conditional operator ``cond ? var1 : var2`` and fixing false
+  positives for functions which contain lambda and ignore parameters
   with ``[[clang::lifetimebound]]`` attribute.
   
 - Improved :doc:`bugprone-sizeof-expression
diff --git 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
index 46cb9063beda97..a3297ca0f8084e 100644
--- 
a/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
+++ 
b/clang-tools-extra/test/clang-tidy/checkers/bugprone/return-const-ref-from-parameter.cpp
@@ -203,3 +203,26 @@ namespace use_lifetime_bound_attr {
 int const &f(int const &a [[clang::lifetimebound]]) { return a; }
 } // namespace use_lifetime_bound_attr
 } // namespace gh117696
+
+
+namespace lambda {
+using T = const int &;
+using K = const float &;
+T inner_valid_lambda(T a) {
+  [&]() -> T { return a; };
+  return a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: returning a constant reference 
parameter
+}
+T inner_invalid_lambda(T a) {
+  [&](T a) -> T { return a; };
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: returning a constant reference 
parameter
+  return a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: returning a constant reference 
parameter
+}
+T inner_invalid_lambda2(T a) {
+  [&](K a) -> K { return a; };
+  // CHECK-MESSAGES: :[[@LINE-1]]:26: warning: returning a constant reference 
parameter
+  return a;
+  // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: returning a constant reference 
parameter
+}
+} // namespace lambda

``




https://github.com/llvm/llvm-project/pull/118990
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang-tools-extra] [clang-tidy] fix false positive in lambda expr for return-const-ref-from-parameter (PR #118990)

2024-12-06 Thread Congcong Cai via llvm-branch-commits

https://github.com/HerrCai0907 edited 
https://github.com/llvm/llvm-project/pull/118990
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

2024-12-06 Thread Leandro Lupori via llvm-branch-commits

luporl wrote:

This also broke the build of 
https://lab.llvm.org/buildbot/#/builders/141/builds/4432.

https://github.com/llvm/llvm-project/pull/83237
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ubsan] Improve lowering of @llvm.allow.ubsan.check (PR #119013)

2024-12-06 Thread Vitaly Buka via llvm-branch-commits

https://github.com/vitalybuka created 
https://github.com/llvm/llvm-project/pull/119013

This fix the case, when single hot inlined callsite, prevent
checks for all other. This helps to reduce number of removed checks up to 50% 
(deppedes on `cutoff-hot` value) .

`ScalarOptimizerLateEPCallback` was happening during
CGSCC walk, after each inlining, but this is effectively
after inlining.

Example, order in comments:

```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  // 3. LowerAllowCheckPass
  set(get() + get());
}

void test() {
  // 4. Inline
  // 5. Nothing for LowerAllowCheckPass
  overflow();
}
```

With this patch it will look like:
```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  set(get() + get());
}

void test() {
  // 3. Inline
  // 4. Simplify
  overflow();
}

// Later, after inliner CGSCC walk complete:
// 5. LowerAllowCheckPass for `overflow`
// 6. LowerAllowCheckPass for `test`
```



___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ubsan] Improve lowering of @llvm.allow.ubsan.check (PR #119013)

2024-12-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Vitaly Buka (vitalybuka)


Changes

This fix the case, when single hot inlined callsite, prevent
checks for all other. This helps to reduce number of removed checks up to 50% 
(deppedes on `cutoff-hot` value) .

`ScalarOptimizerLateEPCallback` was happening during
CGSCC walk, after each inlining, but this is effectively
after inlining.

Example, order in comments:

```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  // 3. LowerAllowCheckPass
  set(get() + get());
}

void test() {
  // 4. Inline
  // 5. Nothing for LowerAllowCheckPass
  overflow();
}
```

With this patch it will look like:
```
static void overflow() {
  // 1. Inline get/set if possible
  // 2. Simplify
  set(get() + get());
}

void test() {
  // 3. Inline
  // 4. Simplify
  overflow();
}

// Later, after inliner CGSCC walk complete:
// 5. LowerAllowCheckPass for `overflow`
// 6. LowerAllowCheckPass for `test`
```


---
Full diff: https://github.com/llvm/llvm-project/pull/119013.diff


2 Files Affected:

- (modified) clang/lib/CodeGen/BackendUtil.cpp (+6-7) 
- (modified) clang/test/CodeGen/allow-ubsan-check-inline.c (+2-2) 


``diff
diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index bf9b04f02e9f44..1f0e760e8ebd29 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -789,13 +789,12 @@ static void addSanitizers(const Triple &TargetTriple,
   }
 
   if (LowerAllowCheckPass::IsRequested()) {
-// We can optimize after inliner, and PGO profile matching. The hook below
-// is called at the end `buildFunctionSimplificationPipeline`, which called
-// from `buildInlinerPipeline`, which called after profile matching.
-PB.registerScalarOptimizerLateEPCallback(
-[](FunctionPassManager &FPM, OptimizationLevel Level) {
-  FPM.addPass(LowerAllowCheckPass());
-});
+// We want to call it after inline, which is about 
OptimizerEarlyEPCallback.
+PB.registerOptimizerEarlyEPCallback([](ModulePassManager &MPM,
+   OptimizationLevel Level,
+   ThinOrFullLTOPhase Phase) {
+  MPM.addPass(createModuleToFunctionPassAdaptor(LowerAllowCheckPass()));
+});
   }
 }
 
diff --git a/clang/test/CodeGen/allow-ubsan-check-inline.c 
b/clang/test/CodeGen/allow-ubsan-check-inline.c
index cabe76d8034d77..1de24ab90dac0e 100644
--- a/clang/test/CodeGen/allow-ubsan-check-inline.c
+++ b/clang/test/CodeGen/allow-ubsan-check-inline.c
@@ -7,8 +7,8 @@ void set(int x);
 // We will only make decision in the `overflow` function.
 // NOINL-COUNT-1: remark: Allowed check:
 
-// FIXME: We will make decision on every inline.
-// INLINE-COUNT-1: remark: Allowed check:
+// We will make decision on every inline.
+// INLINE-COUNT-5: remark: Allowed check:
 
 static void overflow() {
   set(get() + get());

``




https://github.com/llvm/llvm-project/pull/119013
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

2024-12-06 Thread Jonas Devlieghere via llvm-branch-commits

JDevlieghere wrote:

This also broke the Darwin LLDB bots:

https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/lldb-cmake/
https://ci.swift.org/view/all/job/llvm.org/view/LLDB/job/as-lldb-cmake/

Given they've been red for 15h and broke various other bots, can you please 
revert while you investigate? 

https://github.com/llvm/llvm-project/pull/83237
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] [Serialization] Code cleanups and polish 83233 (PR #83237)

2024-12-06 Thread via llvm-branch-commits

zeroomega wrote:

Change b5bd1928c6d43bc525a4e3fb65d2c750d61e broke llvm's windows bots. See 
: https://lab.llvm.org/buildbot/#/builders/63/builds/2944 and this patch is the 
only commit in the blame list.

I reverted this patch in 12bdeba76eef1c7adf004a280036a7fb690ba573. Please 
reland the change after fixing the underlying issues.

https://github.com/llvm/llvm-project/pull/83237
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [ubsan] Improve lowering of @llvm.allow.ubsan.check (PR #119013)

2024-12-06 Thread Kirill Stoimenov via llvm-branch-commits

https://github.com/kstoimenov approved this pull request.


https://github.com/llvm/llvm-project/pull/119013
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/19.x: [Clang][perf-training] Fix clean command in perf-helper.py (#118978) (PR #119051)

2024-12-06 Thread via llvm-branch-commits

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/119051
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/19.x: [Clang][perf-training] Fix clean command in perf-helper.py (#118978) (PR #119051)

2024-12-06 Thread via llvm-branch-commits

https://github.com/llvmbot created 
https://github.com/llvm/llvm-project/pull/119051

Backport 18af3fc1bf8855e1e166e64a9210ed07d610aa54

Requested by: @tstellar

>From 0b1ed9168731f0bee35542988ec9867ebd3cfc47 Mon Sep 17 00:00:00 2001
From: Tom Stellard 
Date: Fri, 6 Dec 2024 18:34:59 -0800
Subject: [PATCH] [Clang][perf-training] Fix clean command in perf-helper.py
 (#118978)

The first path argument was always being ignored, and since most calls
to this command only passed one path, it wasn't actually doing anything
in most cases.

This bug was introduced by dd0356d741aefa25ece973d6cc4b55dcb73b84b4.

(cherry picked from commit 18af3fc1bf8855e1e166e64a9210ed07d610aa54)
---
 clang/utils/perf-training/perf-helper.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/utils/perf-training/perf-helper.py 
b/clang/utils/perf-training/perf-helper.py
index 3ed42a187fd803..d76c6ede3fe5a2 100644
--- a/clang/utils/perf-training/perf-helper.py
+++ b/clang/utils/perf-training/perf-helper.py
@@ -36,7 +36,7 @@ def clean(args):
 + "\tRemoves all files with extension from ."
 )
 return 1
-for path in args[1:-1]:
+for path in args[0:-1]:
 for filename in findFilesWithExtension(path, args[-1]):
 os.remove(filename)
 return 0

___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/19.x: [Clang][perf-training] Fix clean command in perf-helper.py (#118978) (PR #119051)

2024-12-06 Thread via llvm-branch-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: None (llvmbot)


Changes

Backport 18af3fc1bf8855e1e166e64a9210ed07d610aa54

Requested by: @tstellar

---
Full diff: https://github.com/llvm/llvm-project/pull/119051.diff


1 Files Affected:

- (modified) clang/utils/perf-training/perf-helper.py (+1-1) 


``diff
diff --git a/clang/utils/perf-training/perf-helper.py 
b/clang/utils/perf-training/perf-helper.py
index 3ed42a187fd803..d76c6ede3fe5a2 100644
--- a/clang/utils/perf-training/perf-helper.py
+++ b/clang/utils/perf-training/perf-helper.py
@@ -36,7 +36,7 @@ def clean(args):
 + "\tRemoves all files with extension from ."
 )
 return 1
-for path in args[1:-1]:
+for path in args[0:-1]:
 for filename in findFilesWithExtension(path, args[-1]):
 os.remove(filename)
 return 0

``




https://github.com/llvm/llvm-project/pull/119051
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [clang] release/19.x: [Clang][perf-training] Fix clean command in perf-helper.py (#118978) (PR #119051)

2024-12-06 Thread via llvm-branch-commits

llvmbot wrote:

@petrhosek What do you think about merging this PR to the release branch?

https://github.com/llvm/llvm-project/pull/119051
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits