[llvm-branch-commits] [clang] 3be7395 - Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on shade…"

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

Author: S. Bharadwaj Yadavalli
Date: 2024-05-06T22:16:35-04:00
New Revision: 3be739599982371e6151561758928007d4dc2762

URL: 
https://github.com/llvm/llvm-project/commit/3be739599982371e6151561758928007d4dc2762
DIFF: 
https://github.com/llvm/llvm-project/commit/3be739599982371e6151561758928007d4dc2762.diff

LOG: Revert "[DirectX][DXIL] Set DXIL Version in DXIL target triple based on 
shade…"

This reverts commit 080978dd2067d0c9ea7e229aa7696c2480d89ef1.

Added: 


Modified: 
clang/lib/Basic/Targets.cpp
clang/lib/Driver/ToolChains/HLSL.cpp
clang/test/CodeGenHLSL/basic-target.c
clang/test/Driver/dxc_dxv_path.hlsl
clang/test/Options/enable_16bit_types_validation.hlsl
clang/unittests/Driver/DXCModeTest.cpp
llvm/include/llvm/TargetParser/Triple.h
llvm/lib/IR/Verifier.cpp
llvm/lib/TargetParser/Triple.cpp
llvm/unittests/TargetParser/TripleTest.cpp

Removed: 




diff  --git a/clang/lib/Basic/Targets.cpp b/clang/lib/Basic/Targets.cpp
index dc1792b3471e6c..e3283510c6aac7 100644
--- a/clang/lib/Basic/Targets.cpp
+++ b/clang/lib/Basic/Targets.cpp
@@ -760,7 +760,7 @@ using namespace clang::targets;
 TargetInfo *
 TargetInfo::CreateTargetInfo(DiagnosticsEngine ,
  const std::shared_ptr ) {
-  llvm::Triple Triple(llvm::Triple::normalize(Opts->Triple));
+  llvm::Triple Triple(Opts->Triple);
 
   // Construct the target
   std::unique_ptr Target = AllocateTarget(Triple, *Opts);

diff  --git a/clang/lib/Driver/ToolChains/HLSL.cpp 
b/clang/lib/Driver/ToolChains/HLSL.cpp
index 8286e3be21803f..558e4db46f8182 100644
--- a/clang/lib/Driver/ToolChains/HLSL.cpp
+++ b/clang/lib/Driver/ToolChains/HLSL.cpp
@@ -98,49 +98,9 @@ std::optional tryParseProfile(StringRef 
Profile) {
   else if (llvm::getAsUnsignedInteger(Parts[2], 0, Minor))
 return std::nullopt;
 
-  // Determine DXIL version using the minor version number of Shader
-  // Model version specified in target profile. Prior to decoupling DXIL 
version
-  // numbering from that of Shader Model DXIL version 1.Y corresponds to SM 
6.Y.
-  // E.g., dxilv1.Y-unknown-shadermodelX.Y-hull
+  // dxil-unknown-shadermodel-hull
   llvm::Triple T;
-  Triple::SubArchType SubArch = llvm::Triple::NoSubArch;
-  switch (Minor) {
-  case 0:
-SubArch = llvm::Triple::DXILSubArch_v1_0;
-break;
-  case 1:
-SubArch = llvm::Triple::DXILSubArch_v1_1;
-break;
-  case 2:
-SubArch = llvm::Triple::DXILSubArch_v1_2;
-break;
-  case 3:
-SubArch = llvm::Triple::DXILSubArch_v1_3;
-break;
-  case 4:
-SubArch = llvm::Triple::DXILSubArch_v1_4;
-break;
-  case 5:
-SubArch = llvm::Triple::DXILSubArch_v1_5;
-break;
-  case 6:
-SubArch = llvm::Triple::DXILSubArch_v1_6;
-break;
-  case 7:
-SubArch = llvm::Triple::DXILSubArch_v1_7;
-break;
-  case 8:
-SubArch = llvm::Triple::DXILSubArch_v1_8;
-break;
-  case OfflineLibMinor:
-// Always consider minor version x as the latest supported DXIL version
-SubArch = llvm::Triple::LatestDXILSubArch;
-break;
-  default:
-// No DXIL Version corresponding to specified Shader Model version found
-return std::nullopt;
-  }
-  T.setArch(Triple::ArchType::dxil, SubArch);
+  T.setArch(Triple::ArchType::dxil);
   T.setOSName(Triple::getOSTypeName(Triple::OSType::ShaderModel).str() +
   VersionTuple(Major, Minor).getAsString());
   T.setEnvironment(Kind);

diff  --git a/clang/test/CodeGenHLSL/basic-target.c 
b/clang/test/CodeGenHLSL/basic-target.c
index b97ebf90a7a107..8db711c3f2a5b1 100644
--- a/clang/test/CodeGenHLSL/basic-target.c
+++ b/clang/test/CodeGenHLSL/basic-target.c
@@ -7,4 +7,4 @@
 // RUN: %clang -target dxil-pc-shadermodel6.0-geometry -S -emit-llvm -o - %s | 
FileCheck %s
 
 // CHECK: target datalayout = 
"e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
-// CHECK: target triple = "dxilv1.0-pc-shadermodel6.0-{{[a-z]+}}"
+// CHECK: target triple = "dxil-pc-shadermodel6.0-{{[a-z]+}}"

diff  --git a/clang/test/Driver/dxc_dxv_path.hlsl 
b/clang/test/Driver/dxc_dxv_path.hlsl
index 4845de11d5b00b..3d8e90d0d91975 100644
--- a/clang/test/Driver/dxc_dxv_path.hlsl
+++ b/clang/test/Driver/dxc_dxv_path.hlsl
@@ -7,12 +7,12 @@
 // DXV_PATH:dxv{{(.exe)?}}" "-" "-o" "-"
 
 // RUN: %clang_dxc -I test -Vd -Tlib_6_3  -### %s 2>&1 | FileCheck %s 
--check-prefix=VD
-// VD:"-cc1"{{.*}}"-triple" "dxilv1.3-unknown-shadermodel6.3-library"
+// VD:"-cc1"{{.*}}"-triple" "dxil-unknown-shadermodel6.3-library"
 // VD-NOT:dxv not found
 
 // RUN: %clang_dxc -Tlib_6_3 -ccc-print-bindings --dxv-path=%T -Fo %t.dxo  %s 
2>&1 | FileCheck %s --check-prefix=BINDINGS
-// BINDINGS: "dxilv1.3-unknown-shadermodel6.3-library" - "clang", inputs: 
["[[INPUT:.+]]"], output: "[[DXC:.+]].dxo"
-// BINDINGS-NEXT: "dxilv1.3-unknown-shadermodel6.3-library" - 
"hlsl::Validator", inputs: ["[[DXC]].dxo"]
+// BINDINGS: 

[llvm-branch-commits] Revert "[BOLT] Sort BranchData in DataAggregator" (PR #91289)

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

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

This reverts commit 224e4cc516c747b4096fdbe4f2c8d46005eaaa65.

Sorting invalidated data indices that are used to lookup frequency
information for branch offsets or calls in NamesToBranches map.

Test Plan: updated bolt-address-translation-yaml.test


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


4 Files Affected:

- (modified) bolt/lib/Profile/DataAggregator.cpp (-6) 
- (added) bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt (+2) 
- (modified) bolt/test/X86/bolt-address-translation-yaml.test (+11) 
- (modified) bolt/test/runtime/X86/fdata-escape-chars.ll (+1-1) 


``diff
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index bd96a7865009a9..4f18c402cc3a0e 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -641,12 +641,6 @@ void DataAggregator::processProfile(BinaryContext ) {
   BF.markProfiled(Flags);
   }
 
-  for (auto  : NamesToBranches)
-llvm::stable_sort(FuncBranches.second.Data);
-
-  for (auto  : NamesToMemEvents)
-llvm::stable_sort(MemEvents.second.Data);
-
   // Release intermediate storage.
   clear(BranchLBRs);
   clear(FallthroughLBRs);
diff --git a/bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt 
b/bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt
new file mode 100644
index 00..e4e1f170343c62
--- /dev/null
+++ b/bolt/test/X86/Inputs/blarge_new_bat_order.preagg.txt
@@ -0,0 +1,2 @@
+B 800154 401050 20 0
+F 800159 800193 7
diff --git a/bolt/test/X86/bolt-address-translation-yaml.test 
b/bolt/test/X86/bolt-address-translation-yaml.test
index f67cc6361c9ef8..c7927f92c9dd95 100644
--- a/bolt/test/X86/bolt-address-translation-yaml.test
+++ b/bolt/test/X86/bolt-address-translation-yaml.test
@@ -15,6 +15,17 @@ BRANCHENTRY-YAML-CHECK:- name: SolveCubic
 BRANCHENTRY-YAML-CHECK:  bid: 0
 BRANCHENTRY-YAML-CHECK:  hash: 0x700F19D2460
 BRANCHENTRY-YAML-CHECK-NEXT: succ: [ { bid: 7, cnt: 1 }
+# Check that the order is correct between BAT YAML and FDATA->YAML.
+RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat_order.preagg.txt \
+RUN:   -w %t.yaml -o %t.fdata
+RUN: llvm-bolt %t.exe -data %t.fdata -w %t.yaml-fdata -o %t.null
+RUN: FileCheck --input-file %t.yaml --check-prefix ORDER-YAML-CHECK %s
+RUN: FileCheck --input-file %t.yaml-fdata --check-prefix ORDER-YAML-CHECK %s
+ORDER-YAML-CHECK:- name: SolveCubic
+ORDER-YAML-CHECK:  bid: 3
+ORDER-YAML-CHECK:  hash: 0xDDA1DC5F69F900AC
+ORDER-YAML-CHECK-NEXT: calls: [ { off: 0x26, fid: [[#]], cnt: 20 } ]
+ORDER-YAML-CHECK-NEXT: succ: [ { bid: 5, cnt: 7 }
 # Large profile test
 RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat.preagg.txt -w %t.yaml 
-o %t.fdata \
 RUN:   2>&1 | FileCheck --check-prefix READ-BAT-CHECK %s
diff --git a/bolt/test/runtime/X86/fdata-escape-chars.ll 
b/bolt/test/runtime/X86/fdata-escape-chars.ll
index 4ea781ad184be1..a5be4e4eb13479 100644
--- a/bolt/test/runtime/X86/fdata-escape-chars.ll
+++ b/bolt/test/runtime/X86/fdata-escape-chars.ll
@@ -88,8 +88,8 @@ define internal void @static_symb_backslash_b() #0 {
 ; INSTR_CHECK: {{([[:xdigit:]]+)}}:   callq   "symb whitespace" # Count: 1
 
 ; PREAGR_FDATA_CHECK: 1 main 0 1 static\ symb\ backslash\\/1 0 0 1
-; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ backslash\\ 0 0 2
 ; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ whitespace 0 0 1
+; PREAGR_FDATA_CHECK: 1 main 0 1 symb\ backslash\\ 0 0 2
 ; PREAGR_FDATA_CHECK: 1 static\ symb\ backslash\\/1 0 1 symb\ whitespace 0 0 1
 ; PREAGR_FDATA_CHECK: 1 symb\ backslash\\ 0 1 symb\ whitespace 0 0 2
 

``




https://github.com/llvm/llvm-project/pull/91289
___
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] Revert "[BOLT] Sort BranchData in DataAggregator" (PR #91289)

2024-05-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/91289

This reverts commit 224e4cc516c747b4096fdbe4f2c8d46005eaaa65.

Sorting invalidated data indices that are used to lookup frequency
information for branch offsets or calls in NamesToBranches map.

Test Plan: updated bolt-address-translation-yaml.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] [GSYM] Include end_sequence debug_line rows in Dwarf transform (PR #90535)

2024-05-06 Thread Greg Clayton via llvm-branch-commits


@@ -424,19 +439,13 @@ static void convertFunctionLineTable(OutputAggregator 
, CUInfo ,
 auto LastLE = FI.OptLineTable->last();
 if (LastLE && LastLE->File == FileIdx && LastLE->Line == Row.Line)
 continue;
+
 // Only push a row if it isn't an end sequence. End sequence markers are
 // included for the last address in a function or the last contiguous
 // address in a sequence.
-if (Row.EndSequence) {

clayborg wrote:

> I'm not quite following the collection of thoughts here, they seem disjoint 
> to me, so trying to discuss:
> 
> > We used to not break out on Row.EndSequence
> 
> I don't understand the relationship between end_sequence and functions with 
> discontiguous ranges - could you describe this connection in more detail?

If a `DW_TAG_subprogram` has N discontiguous ranges, we will create N 
FunctionInfo objects, one for each range. We will request the line table 
entries for each range in the `DW_TAG_subprogram`'s `DW_AT_ranges` attribute.  
So if there are end sequences in there, we try to keep going. If there is an 
end_sequence in the line table this is probably the indication of a bug in the 
line tables.

> 
> > as it allows functions to have discontiguous ranges.
> 
> Agreed with @pogo59, I believe both Bolt and Propeller can create 
> discontiguous address ranges for a function (but you'll see DW_AT_ranges on 
> the subprogram)

Yes, and as I mention above, we create individual FunctionInfo objects for each 
range and only request the line table entries for each individual range.
> 
> > I was assuming that if we asked for the rows for a given address range we 
> > wouldn't get all entries if two merged functions with different line table 
> > entries were found, but that assumption might not be correct?
> 
> Yeah, looking at the implementation of `lookupAddressRangeImpl` it finds a 
> single sequence that starts closest to the start address, then adds all rows 
> within that sequence that cover the range requested. So, no, it won't 
> retrieve addresses/ranges from multiple sequences.



https://github.com/llvm/llvm-project/pull/90535
___
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] release/18.x: [FunctionAttrs] Fix incorrect nonnull inference for non-inbounds GEP (#91180) (PR #91286)

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

llvmbot wrote:




@llvm/pr-subscribers-llvm-transforms

Author: None (llvmbot)


Changes

Backport f34d30cdae0f59698f660d5cc8fb993fb3441064

Requested by: @nikic

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


3 Files Affected:

- (modified) llvm/lib/Transforms/IPO/FunctionAttrs.cpp (+6-1) 
- (modified) llvm/test/Transforms/FunctionAttrs/nocapture.ll (+1-1) 
- (modified) llvm/test/Transforms/FunctionAttrs/nonnull.ll (+19-4) 


``diff
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp 
b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 7ebf265e17ba1f..27c411250d53c5 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1186,10 +1186,15 @@ static bool isReturnNonNull(Function *F, const 
SCCNodeSet ,
 switch (RVI->getOpcode()) {
 // Extend the analysis by looking upwards.
 case Instruction::BitCast:
-case Instruction::GetElementPtr:
 case Instruction::AddrSpaceCast:
   FlowsToReturn.insert(RVI->getOperand(0));
   continue;
+case Instruction::GetElementPtr:
+  if (cast(RVI)->isInBounds()) {
+FlowsToReturn.insert(RVI->getOperand(0));
+continue;
+  }
+  return false;
 case Instruction::Select: {
   SelectInst *SI = cast(RVI);
   FlowsToReturn.insert(SI->getTrueValue());
diff --git a/llvm/test/Transforms/FunctionAttrs/nocapture.ll 
b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
index 3d483f671b1af7..8d6f6a7c73f809 100644
--- a/llvm/test/Transforms/FunctionAttrs/nocapture.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
@@ -197,7 +197,7 @@ declare i32 @__gxx_personality_v0(...)
 
 define ptr @lookup_bit(ptr %q, i32 %bitno) readnone nounwind {
 ; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind 
willreturn memory(none)
-; FNATTRS-LABEL: define nonnull ptr @lookup_bit
+; FNATTRS-LABEL: define ptr @lookup_bit
 ; FNATTRS-SAME: (ptr [[Q:%.*]], i32 [[BITNO:%.*]]) #[[ATTR0]] {
 ; FNATTRS-NEXT:[[TMP:%.*]] = ptrtoint ptr [[Q]] to i32
 ; FNATTRS-NEXT:[[TMP2:%.*]] = lshr i32 [[TMP]], [[BITNO]]
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll 
b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index d9bdb6298ed0fd..ec5545b969e550 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -905,26 +905,26 @@ define i1 @parent8(ptr %a, ptr %bogus1, ptr %b) 
personality ptr @esfp{
 ; FNATTRS-SAME: ptr nonnull [[A:%.*]], ptr nocapture readnone [[BOGUS1:%.*]], 
ptr nonnull [[B:%.*]]) #[[ATTR7]] personality ptr @esfp {
 ; FNATTRS-NEXT:  entry:
 ; FNATTRS-NEXT:invoke void @use2nonnull(ptr [[A]], ptr [[B]])
-; FNATTRS-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
+; FNATTRS-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
 ; FNATTRS:   cont:
 ; FNATTRS-NEXT:[[NULL_CHECK:%.*]] = icmp eq ptr [[B]], null
 ; FNATTRS-NEXT:ret i1 [[NULL_CHECK]]
 ; FNATTRS:   exc:
 ; FNATTRS-NEXT:[[LP:%.*]] = landingpad { ptr, i32 }
-; FNATTRS-NEXT:filter [0 x ptr] zeroinitializer
+; FNATTRS-NEXT:filter [0 x ptr] zeroinitializer
 ; FNATTRS-NEXT:unreachable
 ;
 ; ATTRIBUTOR-LABEL: define i1 @parent8(
 ; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr nocapture nofree readnone 
[[BOGUS1:%.*]], ptr nonnull [[B:%.*]]) #[[ATTR8]] personality ptr @esfp {
 ; ATTRIBUTOR-NEXT:  entry:
 ; ATTRIBUTOR-NEXT:invoke void @use2nonnull(ptr nonnull [[A]], ptr nonnull 
[[B]])
-; ATTRIBUTOR-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
+; ATTRIBUTOR-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
 ; ATTRIBUTOR:   cont:
 ; ATTRIBUTOR-NEXT:[[NULL_CHECK:%.*]] = icmp eq ptr [[B]], null
 ; ATTRIBUTOR-NEXT:ret i1 [[NULL_CHECK]]
 ; ATTRIBUTOR:   exc:
 ; ATTRIBUTOR-NEXT:[[LP:%.*]] = landingpad { ptr, i32 }
-; ATTRIBUTOR-NEXT:filter [0 x ptr] zeroinitializer
+; ATTRIBUTOR-NEXT:filter [0 x ptr] zeroinitializer
 ; ATTRIBUTOR-NEXT:unreachable
 ;
 
@@ -1415,5 +1415,20 @@ define void @PR43833_simple(ptr %0, i32 %1) {
   br i1 %11, label %7, label %8
 }
 
+define ptr @pr91177_non_inbounds_gep(ptr nonnull %arg) {
+; FNATTRS-LABEL: define ptr @pr91177_non_inbounds_gep(
+; FNATTRS-SAME: ptr nonnull readnone [[ARG:%.*]]) #[[ATTR0]] {
+; FNATTRS-NEXT:[[RES:%.*]] = getelementptr i8, ptr [[ARG]], i64 -8
+; FNATTRS-NEXT:ret ptr [[RES]]
+;
+; ATTRIBUTOR-LABEL: define ptr @pr91177_non_inbounds_gep(
+; ATTRIBUTOR-SAME: ptr nofree nonnull readnone [[ARG:%.*]]) #[[ATTR0]] {
+; ATTRIBUTOR-NEXT:[[RES:%.*]] = getelementptr i8, ptr [[ARG]], i64 -8
+; ATTRIBUTOR-NEXT:ret ptr [[RES]]
+;
+  %res = getelementptr i8, ptr %arg, i64 -8
+  ret ptr %res
+}
+
 attributes #0 = { null_pointer_is_valid }
 attributes #1 = { nounwind willreturn}

``




https://github.com/llvm/llvm-project/pull/91286
___
llvm-branch-commits mailing list

[llvm-branch-commits] [llvm] release/18.x: [FunctionAttrs] Fix incorrect nonnull inference for non-inbounds GEP (#91180) (PR #91286)

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

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

Backport f34d30cdae0f59698f660d5cc8fb993fb3441064

Requested by: @nikic

>From f52cdf6d71642ce1dd63961437597059b6e06e91 Mon Sep 17 00:00:00 2001
From: Nikita Popov 
Date: Tue, 7 May 2024 09:47:28 +0900
Subject: [PATCH] [FunctionAttrs] Fix incorrect nonnull inference for
 non-inbounds GEP (#91180)

For inbounds GEPs, if the source pointer is non-null, the result must
also be non-null. However, this does not hold for non-inbounds GEPs.

Fixes https://github.com/llvm/llvm-project/issues/91177.

(cherry picked from commit f34d30cdae0f59698f660d5cc8fb993fb3441064)
---
 llvm/lib/Transforms/IPO/FunctionAttrs.cpp |  7 +-
 .../Transforms/FunctionAttrs/nocapture.ll |  2 +-
 llvm/test/Transforms/FunctionAttrs/nonnull.ll | 23 +++
 3 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp 
b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 7ebf265e17ba1f..27c411250d53c5 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -1186,10 +1186,15 @@ static bool isReturnNonNull(Function *F, const 
SCCNodeSet ,
 switch (RVI->getOpcode()) {
 // Extend the analysis by looking upwards.
 case Instruction::BitCast:
-case Instruction::GetElementPtr:
 case Instruction::AddrSpaceCast:
   FlowsToReturn.insert(RVI->getOperand(0));
   continue;
+case Instruction::GetElementPtr:
+  if (cast(RVI)->isInBounds()) {
+FlowsToReturn.insert(RVI->getOperand(0));
+continue;
+  }
+  return false;
 case Instruction::Select: {
   SelectInst *SI = cast(RVI);
   FlowsToReturn.insert(SI->getTrueValue());
diff --git a/llvm/test/Transforms/FunctionAttrs/nocapture.ll 
b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
index 3d483f671b1af7..8d6f6a7c73f809 100644
--- a/llvm/test/Transforms/FunctionAttrs/nocapture.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nocapture.ll
@@ -197,7 +197,7 @@ declare i32 @__gxx_personality_v0(...)
 
 define ptr @lookup_bit(ptr %q, i32 %bitno) readnone nounwind {
 ; FNATTRS: Function Attrs: mustprogress nofree norecurse nosync nounwind 
willreturn memory(none)
-; FNATTRS-LABEL: define nonnull ptr @lookup_bit
+; FNATTRS-LABEL: define ptr @lookup_bit
 ; FNATTRS-SAME: (ptr [[Q:%.*]], i32 [[BITNO:%.*]]) #[[ATTR0]] {
 ; FNATTRS-NEXT:[[TMP:%.*]] = ptrtoint ptr [[Q]] to i32
 ; FNATTRS-NEXT:[[TMP2:%.*]] = lshr i32 [[TMP]], [[BITNO]]
diff --git a/llvm/test/Transforms/FunctionAttrs/nonnull.ll 
b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
index d9bdb6298ed0fd..ec5545b969e550 100644
--- a/llvm/test/Transforms/FunctionAttrs/nonnull.ll
+++ b/llvm/test/Transforms/FunctionAttrs/nonnull.ll
@@ -905,26 +905,26 @@ define i1 @parent8(ptr %a, ptr %bogus1, ptr %b) 
personality ptr @esfp{
 ; FNATTRS-SAME: ptr nonnull [[A:%.*]], ptr nocapture readnone [[BOGUS1:%.*]], 
ptr nonnull [[B:%.*]]) #[[ATTR7]] personality ptr @esfp {
 ; FNATTRS-NEXT:  entry:
 ; FNATTRS-NEXT:invoke void @use2nonnull(ptr [[A]], ptr [[B]])
-; FNATTRS-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
+; FNATTRS-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
 ; FNATTRS:   cont:
 ; FNATTRS-NEXT:[[NULL_CHECK:%.*]] = icmp eq ptr [[B]], null
 ; FNATTRS-NEXT:ret i1 [[NULL_CHECK]]
 ; FNATTRS:   exc:
 ; FNATTRS-NEXT:[[LP:%.*]] = landingpad { ptr, i32 }
-; FNATTRS-NEXT:filter [0 x ptr] zeroinitializer
+; FNATTRS-NEXT:filter [0 x ptr] zeroinitializer
 ; FNATTRS-NEXT:unreachable
 ;
 ; ATTRIBUTOR-LABEL: define i1 @parent8(
 ; ATTRIBUTOR-SAME: ptr nonnull [[A:%.*]], ptr nocapture nofree readnone 
[[BOGUS1:%.*]], ptr nonnull [[B:%.*]]) #[[ATTR8]] personality ptr @esfp {
 ; ATTRIBUTOR-NEXT:  entry:
 ; ATTRIBUTOR-NEXT:invoke void @use2nonnull(ptr nonnull [[A]], ptr nonnull 
[[B]])
-; ATTRIBUTOR-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
+; ATTRIBUTOR-NEXT:to label [[CONT:%.*]] unwind label [[EXC:%.*]]
 ; ATTRIBUTOR:   cont:
 ; ATTRIBUTOR-NEXT:[[NULL_CHECK:%.*]] = icmp eq ptr [[B]], null
 ; ATTRIBUTOR-NEXT:ret i1 [[NULL_CHECK]]
 ; ATTRIBUTOR:   exc:
 ; ATTRIBUTOR-NEXT:[[LP:%.*]] = landingpad { ptr, i32 }
-; ATTRIBUTOR-NEXT:filter [0 x ptr] zeroinitializer
+; ATTRIBUTOR-NEXT:filter [0 x ptr] zeroinitializer
 ; ATTRIBUTOR-NEXT:unreachable
 ;
 
@@ -1415,5 +1415,20 @@ define void @PR43833_simple(ptr %0, i32 %1) {
   br i1 %11, label %7, label %8
 }
 
+define ptr @pr91177_non_inbounds_gep(ptr nonnull %arg) {
+; FNATTRS-LABEL: define ptr @pr91177_non_inbounds_gep(
+; FNATTRS-SAME: ptr nonnull readnone [[ARG:%.*]]) #[[ATTR0]] {
+; FNATTRS-NEXT:[[RES:%.*]] = getelementptr i8, ptr [[ARG]], i64 -8
+; FNATTRS-NEXT:ret ptr [[RES]]
+;
+; ATTRIBUTOR-LABEL: define ptr @pr91177_non_inbounds_gep(
+; ATTRIBUTOR-SAME: ptr nofree nonnull readnone [[ARG:%.*]]) #[[ATTR0]] {
+; 

[llvm-branch-commits] [llvm] release/18.x: [FunctionAttrs] Fix incorrect nonnull inference for non-inbounds GEP (#91180) (PR #91286)

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

https://github.com/llvmbot milestoned 
https://github.com/llvm/llvm-project/pull/91286
___
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] [MTE] add stack frame history buffer (PR #86356)

2024-05-06 Thread Florian Mayer via llvm-branch-commits

https://github.com/fmayer updated 
https://github.com/llvm/llvm-project/pull/86356

>From a64c5d63a4df7f59845291ca0d634466713b1ff8 Mon Sep 17 00:00:00 2001
From: Florian Mayer 
Date: Fri, 29 Mar 2024 16:53:52 -0700
Subject: [PATCH 1/4] update

Created using spr 1.3.4
---
 llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp 
b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index a6e236386d5baa..6538abea832907 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -489,7 +489,6 @@ Instruction *AArch64StackTagging::insertBaseTaggedPointer(
 
 auto *IntptrTy = IRB.getIntPtrTy(M.getDataLayout());
 Value *SlotPtr = memtag::getAndroidSlotPtr(IRB, StackMteSlot);
-SlotPtr->setName("TLS_SLOT_STACK_MTE");
 auto *ThreadLong = IRB.CreateLoad(IntptrTy, SlotPtr);
 Value *TaggedFP = IRB.CreateOr(
 memtag::getFP(IRB),

>From 8591fb38c7e065862a0814792a368e2983b8b10c Mon Sep 17 00:00:00 2001
From: Florian Mayer 
Date: Mon, 29 Apr 2024 14:45:16 -0700
Subject: [PATCH 2/4] api lvl

Created using spr 1.3.4
---
 llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp 
b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index 840635315eee04..e38cce94a5cc0b 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -484,7 +484,7 @@ Instruction *AArch64StackTagging::insertBaseTaggedPointer(
   Base->setName("basetag");
   auto TargetTriple = Triple(M.getTargetTriple());
   if (ClRecordStackHistory == instr && TargetTriple.isAndroid() &&
-  TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(35)) {
+  TargetTriple.isAArch64() && !TargetTriple.isAndroidVersionLT(36)) {
 constexpr int StackMteSlot = -3;
 constexpr uint64_t TagMask = 0xFULL << 56;
 

>From 66fbd757608c44b04d64de3f058ce813b14706fe Mon Sep 17 00:00:00 2001
From: Florian Mayer 
Date: Mon, 29 Apr 2024 16:00:09 -0700
Subject: [PATCH 3/4] hidden

Created using spr 1.3.4
---
 llvm/lib/Target/AArch64/AArch64StackTagging.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp 
b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index e38cce94a5cc0b..43d82a1234f7af 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -102,7 +102,7 @@ static cl::opt ClRecordStackHistory(
 cl::values(clEnumVal(none, "Do not record stack ring history"),
clEnumVal(instr, "Insert instructions into the prologue for "
 "storing into the stack ring buffer")),
-cl::Hidden, cl::init(instr));
+cl::Hidden, cl::init(none));
 
 static const Align kTagGranuleSize = Align(16);
 

>From 62c281253d2e5b38619b3395bcb5f0aa7cb3e8d8 Mon Sep 17 00:00:00 2001
From: Florian Mayer 
Date: Mon, 6 May 2024 17:40:16 -0700
Subject: [PATCH 4/4] fp

Created using spr 1.3.4
---
 llvm/lib/Target/AArch64/AArch64FrameLowering.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp 
b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
index c86c98eed24f08..491a46e03b1d14 100644
--- a/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
+++ b/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
@@ -2497,7 +2497,8 @@ AArch64FrameLowering::getFrameIndexReference(const 
MachineFunction , int FI,
   return resolveFrameIndexReference(
   MF, FI, FrameReg,
   /*PreferFP=*/
-  MF.getFunction().hasFnAttribute(Attribute::SanitizeHWAddress),
+  MF.getFunction().hasFnAttribute(Attribute::SanitizeHWAddress) ||
+  MF.getFunction().hasFnAttribute(Attribute::SanitizeMemTag),
   /*ForSimm=*/false);
 }
 

___
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] [ThinLTO] Generate import status in per-module combined summary (PR #88024)

2024-05-06 Thread Mingming Liu via llvm-branch-commits

minglotus-6 wrote:

https://github.com/llvm/llvm-project/pull/87600 is a functional change and the 
diffbase of this patch, and 
`llvm/test/ThinLTO/X86/import_callee_declaration.ll` should be a test case for 
both patches. 

In the [diffbase](https://github.com/llvm/llvm-project/pull/87600), bitcode 
writer takes maps as additional parameters to populate import status, and it's 
not straightforward to construct regression tests there without this patch.  I 
wonder if I shall introduce `cl::list` in llvm-lto/llvm-lto2 (as a 
repeated arg) to specify `filename:GUID` to test the diffbase alone. 

https://github.com/llvm/llvm-project/pull/88024
___
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] [ThinLTO] Generate import status in per-module combined summary (PR #88024)

2024-05-06 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 edited 
https://github.com/llvm/llvm-project/pull/88024
___
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][ThinLTO] Generate import status in per-module combined summary (PR #88024)

2024-05-06 Thread Mingming Liu via llvm-branch-commits

minglotus-6 wrote:

Tagging @jvoung since I cannot add you into reviewer.

https://github.com/llvm/llvm-project/pull/88024
___
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][ThinLTO] Generate import status in per-module combined summary (PR #88024)

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

llvmbot wrote:




@llvm/pr-subscribers-llvm-ir

Author: Mingming Liu (minglotus-6)


Changes

The goal is to generate `declaration` import status in the per-module combined 
summaries, when the function's definition is not imported.

Implementation notes:
* ThinLink
  1.  Adds `-import-declaration` (default false). `selectCallee` stores the 
summary corresponding to {noinline,too-large} callees as output parameter, and 
the result is used to populate `{Import,Export}List` only if 
`import-declaration` is true.
  2. When function `foo` of a module needs the declaration of `callee` while 
function `bar` in the same module needs the definition of `callee`, definition 
will take precedence over declaration.
* Postlink
   - With this patch, the postlink pipeline is updated to keep its current 
behavior (import definitions), but not updated to handle `declaration` 
summaries.  Two use cases ([better call-graph 
sort](https://discourse.llvm.org/t/rfc-for-better-call-graph-sort-build-a-more-complete-call-graph-by-adding-more-indirect-call-edges/74029#support-cross-module-function-declaration-import-5)
 or [cross-module 
auto-init](https://github.com/llvm/llvm-project/pull/87597#discussion_r1556067195))
 would use this bit differently.


---

Patch is 43.68 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/88024.diff


12 Files Affected:

- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+5-1) 
- (modified) llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h (+2-1) 
- (modified) llvm/include/llvm/Transforms/IPO/FunctionImport.h (+15-6) 
- (modified) llvm/lib/LTO/LTO.cpp (+11-7) 
- (modified) llvm/lib/LTO/LTOBackend.cpp (+8-1) 
- (modified) llvm/lib/LTO/ThinLTOCodeGenerator.cpp (+10-3) 
- (modified) llvm/lib/Transforms/IPO/FunctionImport.cpp (+207-70) 
- (modified) llvm/test/ThinLTO/X86/funcimport-stats.ll (+2-2) 
- (added) llvm/test/ThinLTO/X86/import_callee_declaration.ll (+165) 
- (modified) llvm/test/Transforms/FunctionImport/funcimport.ll (+6-2) 
- (modified) llvm/tools/llvm-link/llvm-link.cpp (+5-1) 
- (modified) llvm/tools/llvm-lto/llvm-lto.cpp (+5-2) 


``diff
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 66209b8cf3ea2d..29d13cf4f4fae6 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -585,7 +585,11 @@ class GlobalValueSummary {
 return Flags.ImportType == GlobalValueSummary::ImportKind::Declaration;
   }
 
-  void setImportKind(ImportKind IK) { Flags.ImportType = IK; }
+  GlobalValueSummary::ImportKind importType() const {
+return static_cast(Flags.ImportType);
+  }
+
+  void setImportType(ImportKind IK) { Flags.ImportType = IK; }
 
   GlobalValue::VisibilityTypes getVisibility() const {
 return (GlobalValue::VisibilityTypes)Flags.Visibility;
diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h 
b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
index c450acda82ad06..6e197ae2f279c9 100644
--- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -276,7 +276,8 @@ class ThinLTOCodeGenerator {
   void gatherImportedSummariesForModule(
   Module , ModuleSummaryIndex ,
   std::map ,
-  const lto::InputFile );
+  const lto::InputFile ,
+  ModuleToGVSummaryPtrSet );
 
   /**
* Perform internalization. Index is updated to reflect linkage changes.
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h 
b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index c4d19e8641eca2..fb38c68b56df0e 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -31,9 +31,9 @@ class Module;
 /// based on the provided summary informations.
 class FunctionImporter {
 public:
-  /// Set of functions to import from a source module. Each entry is a set
-  /// containing all the GUIDs of all functions to import for a source module.
-  using FunctionsToImportTy = std::unordered_set;
+  /// The functions to import from a source module and their import type.
+  using FunctionsToImportTy =
+  DenseMap;
 
   /// The different reasons selectCallee will chose not to import a
   /// candidate.
@@ -99,8 +99,12 @@ class FunctionImporter {
   /// index's module path string table).
   using ImportMapTy = DenseMap;
 
-  /// The set contains an entry for every global value the module exports.
-  using ExportSetTy = DenseSet;
+  /// The map contains an entry for every global value the module exports.
+  /// The key is ValueInfo, and the value indicates whether the definition
+  /// or declaration is visible to another module. If a function's definition 
is
+  /// visible to other modules, the global values this function referenced are
+  /// visible and shouldn't be internalized.
+  using ExportSetTy = DenseMap;
 
   /// A function of this type is used to load modules referenced by the index.
   

[llvm-branch-commits] [llvm] [nfc][ThinLTO] Generate import status in per-module combined summary (PR #88024)

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

llvmbot wrote:




@llvm/pr-subscribers-lto

Author: Mingming Liu (minglotus-6)


Changes

The goal is to generate `declaration` import status in the per-module combined 
summaries, when the function's definition is not imported.

Implementation notes:
* ThinLink
  1.  Adds `-import-declaration` (default false). `selectCallee` stores the 
summary corresponding to {noinline,too-large} callees as output parameter, and 
the result is used to populate `{Import,Export}List` only if 
`import-declaration` is true.
  2. When function `foo` of a module needs the declaration of `callee` while 
function `bar` in the same module needs the definition of `callee`, definition 
will take precedence over declaration.
* Postlink
   - With this patch, the postlink pipeline is updated to keep its current 
behavior (import definitions), but not updated to handle `declaration` 
summaries.  Two use cases ([better call-graph 
sort](https://discourse.llvm.org/t/rfc-for-better-call-graph-sort-build-a-more-complete-call-graph-by-adding-more-indirect-call-edges/74029#support-cross-module-function-declaration-import-5)
 or [cross-module 
auto-init](https://github.com/llvm/llvm-project/pull/87597#discussion_r1556067195))
 would use this bit differently.


---

Patch is 43.68 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/88024.diff


12 Files Affected:

- (modified) llvm/include/llvm/IR/ModuleSummaryIndex.h (+5-1) 
- (modified) llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h (+2-1) 
- (modified) llvm/include/llvm/Transforms/IPO/FunctionImport.h (+15-6) 
- (modified) llvm/lib/LTO/LTO.cpp (+11-7) 
- (modified) llvm/lib/LTO/LTOBackend.cpp (+8-1) 
- (modified) llvm/lib/LTO/ThinLTOCodeGenerator.cpp (+10-3) 
- (modified) llvm/lib/Transforms/IPO/FunctionImport.cpp (+207-70) 
- (modified) llvm/test/ThinLTO/X86/funcimport-stats.ll (+2-2) 
- (added) llvm/test/ThinLTO/X86/import_callee_declaration.ll (+165) 
- (modified) llvm/test/Transforms/FunctionImport/funcimport.ll (+6-2) 
- (modified) llvm/tools/llvm-link/llvm-link.cpp (+5-1) 
- (modified) llvm/tools/llvm-lto/llvm-lto.cpp (+5-2) 


``diff
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 66209b8cf3ea2d..29d13cf4f4fae6 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -585,7 +585,11 @@ class GlobalValueSummary {
 return Flags.ImportType == GlobalValueSummary::ImportKind::Declaration;
   }
 
-  void setImportKind(ImportKind IK) { Flags.ImportType = IK; }
+  GlobalValueSummary::ImportKind importType() const {
+return static_cast(Flags.ImportType);
+  }
+
+  void setImportType(ImportKind IK) { Flags.ImportType = IK; }
 
   GlobalValue::VisibilityTypes getVisibility() const {
 return (GlobalValue::VisibilityTypes)Flags.Visibility;
diff --git a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h 
b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
index c450acda82ad06..6e197ae2f279c9 100644
--- a/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
+++ b/llvm/include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
@@ -276,7 +276,8 @@ class ThinLTOCodeGenerator {
   void gatherImportedSummariesForModule(
   Module , ModuleSummaryIndex ,
   std::map ,
-  const lto::InputFile );
+  const lto::InputFile ,
+  ModuleToGVSummaryPtrSet );
 
   /**
* Perform internalization. Index is updated to reflect linkage changes.
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h 
b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index c4d19e8641eca2..fb38c68b56df0e 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -31,9 +31,9 @@ class Module;
 /// based on the provided summary informations.
 class FunctionImporter {
 public:
-  /// Set of functions to import from a source module. Each entry is a set
-  /// containing all the GUIDs of all functions to import for a source module.
-  using FunctionsToImportTy = std::unordered_set;
+  /// The functions to import from a source module and their import type.
+  using FunctionsToImportTy =
+  DenseMap;
 
   /// The different reasons selectCallee will chose not to import a
   /// candidate.
@@ -99,8 +99,12 @@ class FunctionImporter {
   /// index's module path string table).
   using ImportMapTy = DenseMap;
 
-  /// The set contains an entry for every global value the module exports.
-  using ExportSetTy = DenseSet;
+  /// The map contains an entry for every global value the module exports.
+  /// The key is ValueInfo, and the value indicates whether the definition
+  /// or declaration is visible to another module. If a function's definition 
is
+  /// visible to other modules, the global values this function referenced are
+  /// visible and shouldn't be internalized.
+  using ExportSetTy = DenseMap;
 
   /// A function of this type is used to load modules referenced by the index.
   

[llvm-branch-commits] [llvm] [nfc][ThinLTO] Generate import status in per-module combined summary (PR #88024)

2024-05-06 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 ready_for_review 
https://github.com/llvm/llvm-project/pull/88024
___
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][ThinLTO] Generate import status in per-module combined summary (PR #88024)

2024-05-06 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 edited 
https://github.com/llvm/llvm-project/pull/88024
___
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] [BOLT][NFC] Unify Intra/InterIndex handling in writeBATYAML (PR #91278)

2024-05-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/91278


___
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] [BOLT][NFC] Unify Intra/InterIndex handling in writeBATYAML (PR #91278)

2024-05-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/91278


___
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] [BOLT] Map branch source address to the containing basic block in BAT YAML (PR #91273)

2024-05-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/91273

>From 2a848b1ac92203f7821d79ffe7cf0d04846542f3 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Mon, 6 May 2024 16:00:01 -0700
Subject: [PATCH] add blarge_new_bat_branchentry.preagg.txt

Created using spr 1.3.4
---
 bolt/test/X86/Inputs/blarge_new_bat_branchentry.preagg.txt | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 bolt/test/X86/Inputs/blarge_new_bat_branchentry.preagg.txt

diff --git a/bolt/test/X86/Inputs/blarge_new_bat_branchentry.preagg.txt 
b/bolt/test/X86/Inputs/blarge_new_bat_branchentry.preagg.txt
new file mode 100644
index 00..546da92f94dbae
--- /dev/null
+++ b/bolt/test/X86/Inputs/blarge_new_bat_branchentry.preagg.txt
@@ -0,0 +1 @@
+B 80010c 800194 1 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][ThinLTO] Generate import status in per-module combined summary (PR #88024)

2024-05-06 Thread Mingming Liu via llvm-branch-commits

https://github.com/minglotus-6 updated 
https://github.com/llvm/llvm-project/pull/88024

>From cfb63d775d43a28b560d938346f1dd4b2dddc765 Mon Sep 17 00:00:00 2001
From: mingmingl 
Date: Thu, 4 Apr 2024 11:54:17 -0700
Subject: [PATCH 1/8] function import changes

---
 llvm/include/llvm/IR/ModuleSummaryIndex.h |  24 
 .../llvm/Transforms/IPO/FunctionImport.h  |  18 ++-
 llvm/lib/LTO/LTO.cpp  |  13 +-
 llvm/lib/LTO/LTOBackend.cpp   |   5 +-
 llvm/lib/LTO/ThinLTOCodeGenerator.cpp |   9 +-
 llvm/lib/Transforms/IPO/FunctionImport.cpp| 130 --
 llvm/tools/llvm-link/llvm-link.cpp|   2 +-
 7 files changed, 146 insertions(+), 55 deletions(-)

diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h 
b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index 286b51bda0e2c1..259fe56ce5f63e 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -296,6 +296,30 @@ template <> struct DenseMapInfo {
   static unsigned getHashValue(ValueInfo I) { return (uintptr_t)I.getRef(); }
 };
 
+struct SummaryImportInfo {
+  enum class ImportType : uint8_t {
+NotImported = 0,
+Declaration = 1,
+Definition = 2,
+  };
+  unsigned Type : 3;
+  SummaryImportInfo() : Type(static_cast(ImportType::NotImported)) {}
+  SummaryImportInfo(ImportType Type) : Type(static_cast(Type)) {}
+
+  // FIXME: delete the first two set* helper function.
+  void updateType(ImportType InputType) {
+Type = std::max(Type, static_cast(InputType));
+  }
+
+  bool isDefinition() const {
+return static_cast(Type) == ImportType::Definition;
+  }
+
+  bool isDeclaration() const {
+return static_cast(Type) == ImportType::Declaration;
+  }
+};
+
 /// Summary of memprof callsite metadata.
 struct CallsiteInfo {
   // Actual callee function.
diff --git a/llvm/include/llvm/Transforms/IPO/FunctionImport.h 
b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
index c4d19e8641eca2..9adc0c31eed439 100644
--- a/llvm/include/llvm/Transforms/IPO/FunctionImport.h
+++ b/llvm/include/llvm/Transforms/IPO/FunctionImport.h
@@ -33,7 +33,14 @@ class FunctionImporter {
 public:
   /// Set of functions to import from a source module. Each entry is a set
   /// containing all the GUIDs of all functions to import for a source module.
-  using FunctionsToImportTy = std::unordered_set;
+  using FunctionsToImportTy = DenseMap;
+
+  // FIXME: Remove this.
+  enum ImportStatus {
+NotImported,
+ImportDeclaration,
+ImportDefinition,
+  };
 
   /// The different reasons selectCallee will chose not to import a
   /// candidate.
@@ -99,8 +106,10 @@ class FunctionImporter {
   /// index's module path string table).
   using ImportMapTy = DenseMap;
 
-  /// The set contains an entry for every global value the module exports.
-  using ExportSetTy = DenseSet;
+  /// The map contains an entry for every global value the module exports, the
+  /// key being the value info, and the value is the summary-based import info.
+  /// FIXME: Does this set need to be a map?
+  using ExportSetTy = DenseMap;
 
   /// A function of this type is used to load modules referenced by the index.
   using ModuleLoaderTy =
@@ -211,7 +220,8 @@ void gatherImportedSummariesForModule(
 StringRef ModulePath,
 const DenseMap ,
 const FunctionImporter::ImportMapTy ,
-std::map );
+std::map ,
+ModuleToGVSummaryPtrSet );
 
 /// Emit into \p OutputFilename the files module \p ModulePath will import 
from.
 std::error_code EmitImportsFiles(
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 53060df7f503e0..ace533fe28c92f 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -159,7 +159,7 @@ void llvm::computeLTOCacheKey(
   std::vector ExportsGUID;
   ExportsGUID.reserve(ExportList.size());
   for (const auto  : ExportList) {
-auto GUID = VI.getGUID();
+auto GUID = VI.first.getGUID();
 ExportsGUID.push_back(GUID);
   }
 
@@ -205,7 +205,7 @@ void llvm::computeLTOCacheKey(
 
 AddUint64(Entry.getFunctions().size());
 for (auto  : Entry.getFunctions())
-  AddUint64(Fn);
+  AddUint64(Fn.first);
   }
 
   // Include the hash for the resolved ODR.
@@ -277,7 +277,7 @@ void llvm::computeLTOCacheKey(
   for (const ImportModule  : ImportModulesVector)
 for (auto  : ImpM.getFunctions()) {
   GlobalValueSummary *S =
-  Index.findSummaryInModule(ImpF, ImpM.getIdentifier());
+  Index.findSummaryInModule(ImpF.first, ImpM.getIdentifier());
   AddUsedThings(S);
   // If this is an alias, we also care about any types/etc. that the 
aliasee
   // may reference.
@@ -1389,15 +1389,18 @@ class lto::ThinBackendProc {
   llvm::StringRef ModulePath,
   const std::string ) {
 std::map ModuleToSummariesForIndex;
+ModuleToGVSummaryPtrSet ModuleToDeclarationSummaries;
 std::error_code EC;
 gatherImportedSummariesForModule(ModulePath, 

[llvm-branch-commits] [BOLT][NFC] Unify Intra/InterIndex handling in writeBATYAML (PR #91278)

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

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes



Test Plan: NFC


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


3 Files Affected:

- (modified) bolt/include/bolt/Profile/DataReader.h (+5-3) 
- (modified) bolt/include/bolt/Profile/ProfileYAMLMapping.h (+3) 
- (modified) bolt/lib/Profile/DataAggregator.cpp (+29-44) 


``diff
diff --git a/bolt/include/bolt/Profile/DataReader.h 
b/bolt/include/bolt/Profile/DataReader.h
index 314dcc91155863..ee65c582891488 100644
--- a/bolt/include/bolt/Profile/DataReader.h
+++ b/bolt/include/bolt/Profile/DataReader.h
@@ -143,9 +143,11 @@ struct FuncBranchData {
   uint64_t getNumExecutedBranches() const;
 
   /// Aggregation helpers
-  DenseMap> IntraIndex;
-  DenseMap> InterIndex;
-  DenseMap> EntryIndex;
+  template 
+  using IndexTy = DenseMap>;
+  IndexTy IntraIndex;
+  IndexTy InterIndex;
+  IndexTy EntryIndex;
 
   void bumpBranchCount(uint64_t OffsetFrom, uint64_t OffsetTo, uint64_t Count,
uint64_t Mispreds);
diff --git a/bolt/include/bolt/Profile/ProfileYAMLMapping.h 
b/bolt/include/bolt/Profile/ProfileYAMLMapping.h
index 9dd3920dbf0943..2521fe6b1e4900 100644
--- a/bolt/include/bolt/Profile/ProfileYAMLMapping.h
+++ b/bolt/include/bolt/Profile/ProfileYAMLMapping.h
@@ -80,6 +80,9 @@ struct SuccessorInfo {
   bool operator!=(const SuccessorInfo ) const {
 return !(*this == Other);
   }
+  bool operator<(const SuccessorInfo ) const {
+return Index < Other.Index;
+  }
 };
 } // end namespace bolt
 
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index 656b025a5d79d7..db0ffcda4d1015 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2354,30 +2354,6 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext ,
   for (auto BI = BlockMap.begin(), BE = BlockMap.end(); BI != BE; ++BI)
 YamlBF.Blocks[BI->second.getBBIndex()].Hash = BI->second.getBBHash();
 
-  auto getSuccessorInfo = [&](uint32_t SuccOffset, unsigned SuccDataIdx) {
-const llvm::bolt::BranchInfo  = Branches.Data.at(SuccDataIdx);
-yaml::bolt::SuccessorInfo SI;
-SI.Index = BlockMap.getBBIndex(SuccOffset);
-SI.Count = BI.Branches;
-SI.Mispreds = BI.Mispreds;
-return SI;
-  };
-
-  auto getCallSiteInfo = [&](Location CallToLoc, unsigned CallToIdx,
- uint32_t Offset) {
-const llvm::bolt::BranchInfo  = Branches.Data.at(CallToIdx);
-yaml::bolt::CallSiteInfo CSI;
-CSI.DestId = 0; // designated for unknown functions
-CSI.EntryDiscriminator = 0;
-CSI.Count = BI.Branches;
-CSI.Mispreds = BI.Mispreds;
-CSI.Offset = Offset;
-if (BinaryData *BD = BC.getBinaryDataByName(CallToLoc.Name))
-  YAMLProfileWriter::setCSIDestination(BC, CSI, BD->getSymbol(), BAT,
-   CallToLoc.Offset);
-return CSI;
-  };
-
   // Lookup containing basic block offset and index
   auto getBlock = [](uint32_t Offset) {
 auto BlockIt = BlockMap.upper_bound(Offset);
@@ -2386,26 +2362,35 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext ,
 return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
   };
 
-  for (const auto &[FromOffset, SuccKV] : Branches.IntraIndex) {
-const auto &[_, Index] = getBlock(FromOffset);
-yaml::bolt::BinaryBasicBlockProfile  = YamlBF.Blocks[Index];
-for (const auto &[SuccOffset, SuccDataIdx] : SuccKV)
-  if (BlockMap.isInputBlock(SuccOffset))
-YamlBB.Successors.emplace_back(
-getSuccessorInfo(SuccOffset, SuccDataIdx));
-  }
-  for (const auto &[FromOffset, CallTo] : Branches.InterIndex) {
-const auto &[BlockOffset, BlockIndex] = getBlock(FromOffset);
-yaml::bolt::BinaryBasicBlockProfile  = 
YamlBF.Blocks[BlockIndex];
-const uint32_t Offset = FromOffset - BlockOffset;
-for (const auto &[CallToLoc, CallToIdx] : CallTo)
-  YamlBB.CallSites.emplace_back(
-  getCallSiteInfo(CallToLoc, CallToIdx, Offset));
-llvm::sort(YamlBB.CallSites, [](yaml::bolt::CallSiteInfo ,
-yaml::bolt::CallSiteInfo ) {
-  return A.Offset < B.Offset;
-});
-  }
+  auto addIndex = [&](const FuncBranchData::IndexTy ) 
{
+using namespace yaml::bolt;
+constexpr bool Calls = std::is_same::value;
+for (const auto &[FromOffset, To] : Index) {
+  const auto &[BlockOffset, BlockIndex] = getBlock(FromOffset);
+  yaml::bolt::BinaryBasicBlockProfile  = YamlBF.Blocks[BlockIndex];
+  for (const auto [Key, DataIdx] : To) {
+const llvm::bolt::BranchInfo  = Branches.Data.at(DataIdx);
+std::conditional_t SI;
+SI.Count = BI.Branches;
+   

[llvm-branch-commits] [BOLT][NFC] Unify Intra/InterIndex handling in writeBATYAML (PR #91278)

2024-05-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/91278



Test Plan: NFC



___
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] [GSYM] Include end_sequence debug_line rows in Dwarf transform (PR #90535)

2024-05-06 Thread David Blaikie via llvm-branch-commits


@@ -424,19 +439,13 @@ static void convertFunctionLineTable(OutputAggregator 
, CUInfo ,
 auto LastLE = FI.OptLineTable->last();
 if (LastLE && LastLE->File == FileIdx && LastLE->Line == Row.Line)
 continue;
+
 // Only push a row if it isn't an end sequence. End sequence markers are
 // included for the last address in a function or the last contiguous
 // address in a sequence.
-if (Row.EndSequence) {

dwblaikie wrote:

I'm not quite following the collection of thoughts here, they seem disjoint to 
me, so trying to discuss:

> We used to not break out on Row.EndSequence 

I don't understand the relationship between end_sequence and functions with 
discontiguous ranges - could you describe this connection in more detail?

> as it allows functions to have discontiguous ranges. 

Agreed with @pogo59, I believe both Bolt and Propeller can create discontiguous 
address ranges for a function (but you'll see DW_AT_ranges on the subprogram)

> I was assuming that if we asked for the rows for a given address range we 
> wouldn't get all entries if two merged functions with different line table 
> entries were found, but that assumption might not be correct?

Yeah, looking at the implementation of `lookupAddressRangeImpl` it finds a 
single sequence that starts closest to the start address, then adds all rows 
within that sequence that cover the range requested. So, no, it won't retrieve 
addresses/ranges from multiple sequences.

https://github.com/llvm/llvm-project/pull/90535
___
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] [BOLT] Map branch source address to the containing basic block in BAT YAML (PR #91273)

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

llvmbot wrote:




@llvm/pr-subscribers-bolt

Author: Amir Ayupov (aaupov)


Changes

Fix an issue where the profile for all branches that have a BRANCHENTRY
is dropped. If the branch has an entry in BAT, it will be translated to
its input offset. We used to only permit the basic block offset as a
branch source. Perform a lookup of containing basic block instead.

Test Plan: Updated bolt-address-translation-yaml.test


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


2 Files Affected:

- (modified) bolt/lib/Profile/DataAggregator.cpp (+10-7) 
- (modified) bolt/test/X86/bolt-address-translation-yaml.test (+11) 


``diff
diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index e4a7324c38175c..656b025a5d79d7 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -2378,10 +2378,16 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext ,
 return CSI;
   };
 
+  // Lookup containing basic block offset and index
+  auto getBlock = [](uint32_t Offset) {
+auto BlockIt = BlockMap.upper_bound(Offset);
+assert(BlockIt != BlockMap.begin());
+--BlockIt;
+return std::pair(BlockIt->first, BlockIt->second.getBBIndex());
+  };
+
   for (const auto &[FromOffset, SuccKV] : Branches.IntraIndex) {
-if (!BlockMap.isInputBlock(FromOffset))
-  continue;
-const unsigned Index = BlockMap.getBBIndex(FromOffset);
+const auto &[_, Index] = getBlock(FromOffset);
 yaml::bolt::BinaryBasicBlockProfile  = YamlBF.Blocks[Index];
 for (const auto &[SuccOffset, SuccDataIdx] : SuccKV)
   if (BlockMap.isInputBlock(SuccOffset))
@@ -2389,10 +2395,7 @@ std::error_code 
DataAggregator::writeBATYAML(BinaryContext ,
 getSuccessorInfo(SuccOffset, SuccDataIdx));
   }
   for (const auto &[FromOffset, CallTo] : Branches.InterIndex) {
-auto BlockIt = BlockMap.upper_bound(FromOffset);
---BlockIt;
-const unsigned BlockOffset = BlockIt->first;
-const unsigned BlockIndex = BlockIt->second.getBBIndex();
+const auto &[BlockOffset, BlockIndex] = getBlock(FromOffset);
 yaml::bolt::BinaryBasicBlockProfile  = 
YamlBF.Blocks[BlockIndex];
 const uint32_t Offset = FromOffset - BlockOffset;
 for (const auto &[CallToLoc, CallToIdx] : CallTo)
diff --git a/bolt/test/X86/bolt-address-translation-yaml.test 
b/bolt/test/X86/bolt-address-translation-yaml.test
index b3d8a88394503c..f67cc6361c9ef8 100644
--- a/bolt/test/X86/bolt-address-translation-yaml.test
+++ b/bolt/test/X86/bolt-address-translation-yaml.test
@@ -5,6 +5,17 @@ RUN: llvm-bolt %t.exe -o %t.out --pa -p 
%p/Inputs/blarge_new.preagg.txt \
 RUN:   --reorder-blocks=ext-tsp --split-functions --split-strategy=cdsplit \
 RUN:   --reorder-functions=cdsort --enable-bat --dyno-stats --skip-funcs=main \
 RUN:   2>&1 | FileCheck --check-prefix WRITE-BAT-CHECK %s
+# Check that branch with entry in BAT is accounted for.
+RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat_branchentry.preagg.txt \
+RUN:   -w %t.yaml -o %t.fdata
+RUN: llvm-bolt %t.exe -data %t.fdata -w %t.yaml-fdata -o %t.null
+RUN: FileCheck --input-file %t.yaml --check-prefix BRANCHENTRY-YAML-CHECK %s
+RUN: FileCheck --input-file %t.yaml-fdata --check-prefix 
BRANCHENTRY-YAML-CHECK %s
+BRANCHENTRY-YAML-CHECK:- name: SolveCubic
+BRANCHENTRY-YAML-CHECK:  bid: 0
+BRANCHENTRY-YAML-CHECK:  hash: 0x700F19D2460
+BRANCHENTRY-YAML-CHECK-NEXT: succ: [ { bid: 7, cnt: 1 }
+# Large profile test
 RUN: perf2bolt %t.out --pa -p %p/Inputs/blarge_new_bat.preagg.txt -w %t.yaml 
-o %t.fdata \
 RUN:   2>&1 | FileCheck --check-prefix READ-BAT-CHECK %s
 RUN: FileCheck --input-file %t.yaml --check-prefix YAML-BAT-CHECK %s

``




https://github.com/llvm/llvm-project/pull/91273
___
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] [BOLT] Map branch source address to the containing basic block in BAT YAML (PR #91273)

2024-05-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov created 
https://github.com/llvm/llvm-project/pull/91273

Fix an issue where the profile for all branches that have a BRANCHENTRY
is dropped. If the branch has an entry in BAT, it will be translated to
its input offset. We used to only permit the basic block offset as a
branch source. Perform a lookup of containing basic block instead.

Test Plan: Updated bolt-address-translation-yaml.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] [llvm] [BOLT] Ignore returns in DataAggregator (PR #90807)

2024-05-06 Thread Amir Ayupov via llvm-branch-commits

https://github.com/aaupov updated 
https://github.com/llvm/llvm-project/pull/90807

>From acf58ceb37d2aa917e8d84d243faadc58f5f3a7d Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Mon, 6 May 2024 13:35:04 -0700
Subject: [PATCH] Simplify IsReturn check

Created using spr 1.3.4
---
 bolt/lib/Profile/DataAggregator.cpp | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp 
b/bolt/lib/Profile/DataAggregator.cpp
index e4a7324c38175c..d02e4499014ed1 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -778,13 +778,13 @@ bool DataAggregator::doBranch(uint64_t From, uint64_t To, 
uint64_t Count,
 if (BinaryFunction *Func = getBinaryFunctionContainingAddress(Addr)) {
   Addr -= Func->getAddress();
   if (IsFrom) {
-if (Func->hasInstructions()) {
-  if (MCInst *Inst = Func->getInstructionAtOffset(Addr))
-IsReturn = BC->MIB->isReturn(*Inst);
-} else if (std::optional Inst =
-Func->disassembleInstructionAtOffset(Addr)) {
-  IsReturn = BC->MIB->isReturn(*Inst);
-}
+auto checkReturn = [&](auto MaybeInst) {
+  IsReturn = MaybeInst && BC->MIB->isReturn(*MaybeInst);
+};
+if (Func->hasInstructions())
+  checkReturn(Func->getInstructionAtOffset(Addr));
+else
+  checkReturn(Func->disassembleInstructionAtOffset(Addr));
   }
 
   if (BAT)

___
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] [compiler-rt] df1fd39 - Revert "[scudo] Only init RingBuffer when needed. (#85994)"

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

Author: Florian Mayer
Date: 2024-05-06T12:00:07-07:00
New Revision: df1fd395bed1c87151e331d7f716a76df3ba4046

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

LOG: Revert "[scudo] Only init RingBuffer when needed. (#85994)"

This reverts commit 0dbd804a690720688d8234d8bdaee8f8f4fdcddc.

Added: 


Modified: 
compiler-rt/lib/scudo/standalone/combined.h
compiler-rt/lib/scudo/standalone/tests/combined_test.cpp

Removed: 




diff  --git a/compiler-rt/lib/scudo/standalone/combined.h 
b/compiler-rt/lib/scudo/standalone/combined.h
index 927513dea92dab..f59295382136bc 100644
--- a/compiler-rt/lib/scudo/standalone/combined.h
+++ b/compiler-rt/lib/scudo/standalone/combined.h
@@ -18,7 +18,6 @@
 #include "local_cache.h"
 #include "mem_map.h"
 #include "memtag.h"
-#include "mutex.h"
 #include "options.h"
 #include "quarantine.h"
 #include "report.h"
@@ -182,17 +181,17 @@ class Allocator {
 Quarantine.init(
 static_cast(getFlags()->quarantine_size_kb << 10),
 static_cast(getFlags()->thread_local_quarantine_size_kb << 10));
+
+mapAndInitializeRingBuffer();
   }
 
-  void enableRingBuffer() NO_THREAD_SAFETY_ANALYSIS {
+  void enableRingBuffer() {
 AllocationRingBuffer *RB = getRingBuffer();
 if (RB)
   RB->Depot->enable();
-RingBufferInitLock.unlock();
   }
 
-  void disableRingBuffer() NO_THREAD_SAFETY_ANALYSIS {
-RingBufferInitLock.lock();
+  void disableRingBuffer() {
 AllocationRingBuffer *RB = getRingBuffer();
 if (RB)
   RB->Depot->disable();
@@ -919,11 +918,9 @@ class Allocator {
   DCHECK(!Primary.Options.load().get(OptionBit::TrackAllocationStacks));
   return;
 }
-
-if (Track) {
-  initRingBufferMaybe();
+if (Track)
   Primary.Options.set(OptionBit::TrackAllocationStacks);
-} else
+else
   Primary.Options.clear(OptionBit::TrackAllocationStacks);
   }
 
@@ -1098,9 +1095,6 @@ class Allocator {
 0,
 "invalid alignment");
 
-  // Lock to initialize the RingBuffer
-  HybridMutex RingBufferInitLock;
-
   // Pointer to memory mapped area starting with AllocationRingBuffer struct,
   // and immediately followed by Size elements of type Entry.
   atomic_uptr RingBufferAddress = {};
@@ -1555,16 +1549,11 @@ class Allocator {
 RBEntryStart)[N];
   }
 
-  void initRingBufferMaybe() {
-ScopedLock L(RingBufferInitLock);
-if (getRingBuffer() != nullptr)
+  void mapAndInitializeRingBuffer() {
+if (getFlags()->allocation_ring_buffer_size <= 0)
   return;
-
-int ring_buffer_size = getFlags()->allocation_ring_buffer_size;
-if (ring_buffer_size <= 0)
-  return;
-
-u32 AllocationRingBufferSize = static_cast(ring_buffer_size);
+u32 AllocationRingBufferSize =
+static_cast(getFlags()->allocation_ring_buffer_size);
 
 // We store alloc and free stacks for each entry.
 constexpr u32 kStacksPerRingBufferEntry = 2;

diff  --git a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp 
b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
index 1a36155bcd423a..6a311adc55e4bd 100644
--- a/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/combined_test.cpp
@@ -867,86 +867,32 @@ SCUDO_TYPED_TEST(ScudoCombinedTest, 
ReallocateInPlaceStress) {
   }
 }
 
-SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferDefaultDisabled) {
-  // The RingBuffer is not initialized until tracking is enabled for the
-  // first time.
-  auto *Allocator = this->Allocator.get();
-  EXPECT_EQ(0u, Allocator->getRingBufferSize());
-  EXPECT_EQ(nullptr, Allocator->getRingBufferAddress());
-}
-
-SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferInitOnce) {
-  auto *Allocator = this->Allocator.get();
-  Allocator->setTrackAllocationStacks(true);
-
-  auto RingBufferSize = Allocator->getRingBufferSize();
-  ASSERT_GT(RingBufferSize, 0u);
-  auto *RingBufferAddress = Allocator->getRingBufferAddress();
-  EXPECT_NE(nullptr, RingBufferAddress);
-
-  // Enable tracking again to verify that the initialization only happens once.
-  Allocator->setTrackAllocationStacks(true);
-  ASSERT_EQ(RingBufferSize, Allocator->getRingBufferSize());
-  EXPECT_EQ(RingBufferAddress, Allocator->getRingBufferAddress());
-}
-
 SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferSize) {
   auto *Allocator = this->Allocator.get();
-  Allocator->setTrackAllocationStacks(true);
-
-  auto RingBufferSize = Allocator->getRingBufferSize();
-  ASSERT_GT(RingBufferSize, 0u);
-  EXPECT_EQ(Allocator->getRingBufferAddress()[RingBufferSize - 1], '\0');
+  auto Size = Allocator->getRingBufferSize();
+  ASSERT_GT(Size, 0u);
+  EXPECT_EQ(Allocator->getRingBufferAddress()[Size - 1], '\0');
 }
 
 SCUDO_TYPED_TEST(ScudoCombinedTest, RingBufferAddress) {
   

[llvm-branch-commits] [libcxx] release/18.x: change the visibility of libc++ header to public in libcxx module (PR #91182)

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

RichardLuo0 wrote:

The checks error seems to have nothing to do with the changes

https://github.com/llvm/llvm-project/pull/91182
___
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-05-06 Thread Ilya Biryukov via llvm-branch-commits

ilya-biryukov wrote:

After endless hours and recompilations, I finally have this to share.
It could probably be smaller, but I decided to share this as soon as it crashed 
outside of our monorepo. 

[module.tgz](https://github.com/llvm/llvm-project/files/15223606/module.tgz)
^^ If you run build.sh with Clang 16, it builds. However, it fails with the 
current patch. 
See out/errors for a list of errors I get on my machine. 
This breaks with libstdc++ 13, but also latest libc++ (which is what we use in 
our monorepo).

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] release/18.x: [AArch64][SelectionDAG] Mask for SUBS with multiple users cannot be elided (#90911) (PR #91151)

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

AtariDreams wrote:

Actually there may be a better solution I'm gonna look into it first 

https://github.com/llvm/llvm-project/pull/91151
___
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] 5714e4d - Revert "Reapply "Use an abbrev to reduce size of VALUE_GUID records in ThinLT…"

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

Author: Chen Zheng
Date: 2024-05-06T21:13:28+08:00
New Revision: 5714e4db0088ff5f8f016a437b61dd1176f7da07

URL: 
https://github.com/llvm/llvm-project/commit/5714e4db0088ff5f8f016a437b61dd1176f7da07
DIFF: 
https://github.com/llvm/llvm-project/commit/5714e4db0088ff5f8f016a437b61dd1176f7da07.diff

LOG: Revert "Reapply "Use an abbrev to reduce size of VALUE_GUID records in 
ThinLT…"

This reverts commit 28869a704ef59471cee6c750f2566b133b0ff391.

Added: 


Modified: 
lld/test/COFF/thinlto-index-only.ll
lld/test/ELF/lto/thinlto-emit-index.ll
lld/test/ELF/lto/thinlto-index-only.ll
lld/test/MachO/thinlto-emit-index.ll
lld/test/MachO/thinlto-index-only.ll
llvm/include/llvm/IR/ModuleSummaryIndex.h
llvm/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
llvm/test/Assembler/thinlto-summary.ll
llvm/test/Bitcode/summary_version.ll
llvm/test/Bitcode/thinlto-alias.ll
llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll

llvm/test/Bitcode/thinlto-function-summary-callgraph-partial-sample-profile-summary.ll
llvm/test/Bitcode/thinlto-function-summary-callgraph-pgo.ll
llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll

llvm/test/Bitcode/thinlto-function-summary-callgraph-sample-profile-summary.ll
llvm/test/Bitcode/thinlto-function-summary-callgraph.ll
llvm/test/Bitcode/thinlto-function-summary-originalnames.ll
llvm/test/Bitcode/thinlto-function-summary-paramaccess.ll
llvm/test/ThinLTO/X86/distributed_indexes.ll
llvm/test/tools/gold/X86/thinlto.ll
llvm/test/tools/llvm-lto/thinlto.ll

Removed: 




diff  --git a/lld/test/COFF/thinlto-index-only.ll 
b/lld/test/COFF/thinlto-index-only.ll
index f99134143e4dc5..8ef981d6090f12 100644
--- a/lld/test/COFF/thinlto-index-only.ll
+++ b/lld/test/COFF/thinlto-index-only.ll
@@ -22,8 +22,8 @@
 ; BACKEND1: = 10) {
-RefGUID = Record[1] << 32 | Record[2];
-  } else {
-RefGUID = Record[1];
-  }
+  GlobalValue::GUID RefGUID = Record[1];
   ValueIdToValueInfoMap[ValueID] = std::make_tuple(
   TheIndex.getOrInsertValueInfo(RefGUID), RefGUID, RefGUID);
   break;

diff  --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp 
b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index 1aaf160e91ca18..6d01e3b4d82189 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -4299,20 +4299,9 @@ void 
ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
 return;
   }
 
-  auto Abbv = std::make_shared();
-  Abbv->Add(BitCodeAbbrevOp(bitc::FS_VALUE_GUID));
-  Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
-  // GUIDS often use up most of 64-bits, so encode as two Fixed 32.
-  Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
-  Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
-  unsigned ValueGuidAbbrev = Stream.EmitAbbrev(std::move(Abbv));
-
   for (const auto  : valueIds()) {
 Stream.EmitRecord(bitc::FS_VALUE_GUID,
-  ArrayRef{GVI.second,
- static_cast(GVI.first >> 
32),
- static_cast(GVI.first)},
-  ValueGuidAbbrev);
+  ArrayRef{GVI.second, GVI.first});
   }
 
   if (!Index->stackIds().empty()) {
@@ -4326,7 +4315,7 @@ void 
ModuleBitcodeWriterBase::writePerModuleGlobalValueSummary() {
   }
 
   // Abbrev for FS_PERMODULE_PROFILE.
-  Abbv = std::make_shared();
+  auto Abbv = std::make_shared();
   Abbv->Add(BitCodeAbbrevOp(bitc::FS_PERMODULE_PROFILE));
   Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));   // valueid
   Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8));   // flags
@@ -4478,20 +4467,9 @@ void 
IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
   // Write the index flags.
   Stream.EmitRecord(bitc::FS_FLAGS, ArrayRef{Index.getFlags()});
 
-  auto Abbv = std::make_shared();
-  Abbv->Add(BitCodeAbbrevOp(bitc::FS_VALUE_GUID));
-  Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6));
-  // GUIDS often use up most of 64-bits, so encode as two Fixed 32.
-  Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
-  Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 32));
-  unsigned ValueGuidAbbrev = Stream.EmitAbbrev(std::move(Abbv));
-
   for (const auto  : valueIds()) {
 Stream.EmitRecord(bitc::FS_VALUE_GUID,
-  ArrayRef{GVI.second,
- static_cast(GVI.first >> 
32),
- static_cast(GVI.first)},
-  ValueGuidAbbrev);
+  ArrayRef{GVI.second, GVI.first});
   }
 
   if (!StackIdIndices.empty()) {
@@ -4510,7 +4488,7 @@ void 
IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
   }
 
   // Abbrev for FS_COMBINED_PROFILE.
-  Abbv = std::make_shared();
+  auto Abbv = 

[llvm-branch-commits] [clang] [clang] Revise IDE folder structure (PR #89743)

2024-05-06 Thread Vlad Serebrennikov via llvm-branch-commits

Endilll wrote:

CC @AaronBallman 

https://github.com/llvm/llvm-project/pull/89743
___
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] [libcxx] release/18.x: change the visibility of libc++ header to public in libcxx module (PR #91182)

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

https://github.com/RichardLuo0 edited 
https://github.com/llvm/llvm-project/pull/91182
___
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] [libcxx] change the visibility of libc++ header to public in libcxx module (PR #91182)

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

llvmbot wrote:




@llvm/pr-subscribers-libcxx

Author: RichardLuo (RichardLuo0)


Changes

This PR addresses a problem that headers may not be able to be found if 
`#include` is used with std modules.

Consider the following file:
```cpp
#include boost/json.hpp
import std;

int main(int, const char **) { }
```
boost will include something from libc++, but we are using 
[-nostdinc++](https://github.com/RichardLuo0/llvm-project/blob/15fdd47c4b110b64dc61f636e42e0484bf8bdbe0/libcxx/modules/CMakeLists.txt.in#L52),
 so the compiler can not find any default std header.
Therefore the locally built header needs to be public.

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


1 Files Affected:

- (modified) libcxx/modules/CMakeLists.txt.in (+2-2) 


``diff
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index e332d70cc16333..1f8f159e710cb9 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -41,7 +41,7 @@ target_sources(std
 std.cppm
 )
 
-target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std SYSTEM PUBLIC @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std PUBLIC -fno-exceptions)
@@ -67,7 +67,7 @@ target_sources(std.compat
 std.compat.cppm
 )
 
-target_include_directories(std.compat SYSTEM PRIVATE 
@LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std.compat SYSTEM PUBLIC 
@LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std.compat PUBLIC -fno-exceptions)

``




https://github.com/llvm/llvm-project/pull/91182
___
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] [libcxx] change the visibility of libc++ header to public in libcxx module (PR #91182)

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

github-actions[bot] wrote:



Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this 
page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using `@` followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from 
other developers.

If you have further questions, they may be answered by the [LLVM GitHub User 
Guide](https://llvm.org/docs/GitHub.html).

You can also ask questions in a comment on this PR, on the [LLVM 
Discord](https://discord.com/invite/xS7Z362) or on the 
[forums](https://discourse.llvm.org/).

https://github.com/llvm/llvm-project/pull/91182
___
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] [libcxx] change the visibility of libc++ header to public in libcxx module (PR #91182)

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

https://github.com/RichardLuo0 created 
https://github.com/llvm/llvm-project/pull/91182

This PR addresses a problem that headers may not be able to be found if 
`#include` is used with std modules.

Consider the following file:
```cpp
#include 
import std;

int main(int, const char **) { }
```
boost will include something from libc++, but we are using 
[-nostdinc++](https://github.com/RichardLuo0/llvm-project/blob/15fdd47c4b110b64dc61f636e42e0484bf8bdbe0/libcxx/modules/CMakeLists.txt.in#L52),
 so the compiler can not find any default std header.
Therefore the locally built header needs to be public.

>From 15fdd47c4b110b64dc61f636e42e0484bf8bdbe0 Mon Sep 17 00:00:00 2001
From: RichardLuo <22096448+richardl...@users.noreply.github.com>
Date: Mon, 6 May 2024 18:16:24 +0800
Subject: [PATCH] change the visibility of libc++ header to public

---
 libcxx/modules/CMakeLists.txt.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index e332d70cc16333..1f8f159e710cb9 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -41,7 +41,7 @@ target_sources(std
 std.cppm
 )
 
-target_include_directories(std SYSTEM PRIVATE @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std SYSTEM PUBLIC @LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std PUBLIC -fno-exceptions)
@@ -67,7 +67,7 @@ target_sources(std.compat
 std.compat.cppm
 )
 
-target_include_directories(std.compat SYSTEM PRIVATE 
@LIBCXX_CONFIGURED_INCLUDE_DIRS@)
+target_include_directories(std.compat SYSTEM PUBLIC 
@LIBCXX_CONFIGURED_INCLUDE_DIRS@)
 
 if (NOT @LIBCXX_ENABLE_EXCEPTIONS@)
   target_compile_options(std.compat PUBLIC -fno-exceptions)

___
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] 0377438 - Revert "Remove redundant move in return statement (#90546)"

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

Author: Mehdi Amini
Date: 2024-05-06T15:47:26+08:00
New Revision: 037743895cde439e45ceba5ab171db252d3c8e62

URL: 
https://github.com/llvm/llvm-project/commit/037743895cde439e45ceba5ab171db252d3c8e62
DIFF: 
https://github.com/llvm/llvm-project/commit/037743895cde439e45ceba5ab171db252d3c8e62.diff

LOG: Revert "Remove redundant move in return statement (#90546)"

This reverts commit db532ff9584a2fe4b375188400986e0dd17ad92b.

Added: 


Modified: 
llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h

Removed: 




diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h 
b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
index 6dd99a76cf2afb..f0263e0d78e75e 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/IndirectionUtils.h
@@ -77,7 +77,7 @@ class TrampolinePool {
 std::lock_guard Lock(TPMutex);
 if (AvailableTrampolines.empty()) {
   if (auto Err = grow())
-return Err;
+return std::move(Err);
 }
 assert(!AvailableTrampolines.empty() && "Failed to grow trampoline pool");
 auto TrampolineAddr = AvailableTrampolines.back();

diff  --git a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h 
b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
index 2608a95e40a36b..3a71ddc88ce956 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/LLJIT.h
@@ -488,18 +488,18 @@ class LLJITBuilderSetters {
   /// Create an instance of the JIT.
   Expected> create() {
 if (auto Err = impl().prepareForConstruction())
-  return Err;
+  return std::move(Err);
 
 Error Err = Error::success();
 std::unique_ptr J(new JITType(impl(), Err));
 if (Err)
-  return Err;
+  return std::move(Err);
 
 if (impl().NotifyCreated)
   if (Error Err = impl().NotifyCreated(*J))
-return Err;
+return std::move(Err);
 
-return J;
+return std::move(J);
   }
 
 protected:



___
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] release/18.x: [SelectionDAG] Mark frame index as "aliased" at argument copy elison (PR #91035)

2024-05-06 Thread Matt Arsenault via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/91035
___
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] release/18.x: [AArch64][GISEL] Consider fcmp true and fcmp false in cond code selection (#86972) (PR #91126)

2024-05-06 Thread Matt Arsenault via llvm-branch-commits

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


https://github.com/llvm/llvm-project/pull/91126
___
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] release/18.x: [AMDGPU] Fix GFX12 encoding of s_wait_event export_ready (#89622) (PR #91034)

2024-05-06 Thread Jay Foad via llvm-branch-commits

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


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