Skip to content

Commit 2936301

Browse files
authored
merge main into amd-staging (llvm#4232)
2 parents 30eef4d + 0435bb3 commit 2936301

File tree

75 files changed

+1247
-754
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+1247
-754
lines changed
Lines changed: 196 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,196 @@
1+
// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm \
2+
// RUN: -debug-info-kind=standalone -std=c++26 %s -o - | FileCheck %s
3+
4+
5+
// CHECK: ![[PACK1:[0-9]+]] = distinct !DISubprogram(name: "capture_pack<int>"
6+
// CHECK: ![[PACK2:[0-9]+]] = distinct !DISubprogram(name: "capture_pack<int, int>"
7+
// CHECK: ![[PACK3:[0-9]+]] = distinct !DISubprogram(name: "capture_pack_and_locals<int>"
8+
// CHECK: ![[PACK4:[0-9]+]] = distinct !DISubprogram(name: "capture_pack_and_locals<int, int>"
9+
// CHECK: ![[PACK5:[0-9]+]] = distinct !DISubprogram(name: "capture_pack_and_this<int>"
10+
// CHECK: ![[PACK6:[0-9]+]] = distinct !DISubprogram(name: "capture_pack_and_this<int, int>"
11+
// CHECK: ![[PACK7:[0-9]+]] = distinct !DISubprogram(name: "capture_binding_and_param_pack<int, int>"
12+
13+
template<typename... Args>
14+
auto capture_pack(Args... args) {
15+
return [args..., ...params = args] {
16+
return 0;
17+
}();
18+
}
19+
20+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK1]]
21+
// CHECK-SAME: elements: ![[PACK1_ELEMS:[0-9]+]]
22+
// CHECK-DAG: ![[PACK1_ELEMS]] = !{![[PACK1_ARGS:[0-9]+]], ![[PACK1_PARAMS:[0-9]+]]}
23+
// CHECK-DAG: ![[PACK1_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
24+
// CHECK-DAG: ![[PACK1_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
25+
// CHECK-NOT: DW_TAG_member
26+
27+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK2]]
28+
// CHECK-SAME: elements: ![[PACK2_ELEMS:[0-9]+]]
29+
// CHECK: ![[PACK2_ELEMS]] = !{![[PACK2_ARGS:[0-9]+]]
30+
// CHECK-SAME: ![[PACK2_ARGS]]
31+
// CHECK-SAME: ![[PACK2_PARAMS:[0-9]+]]
32+
// CHECK-SAME: ![[PACK2_PARAMS]]}
33+
// CHECK-DAG: ![[PACK2_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
34+
// CHECK-DAG: ![[PACK2_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
35+
// CHECK-NOT: DW_TAG_member
36+
37+
template<typename... Args>
38+
auto capture_pack_and_locals(int x, Args... args) {
39+
int w = 0;
40+
return [=, &args..., &x, ...params = args] {
41+
return w;
42+
}();
43+
}
44+
45+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK3]]
46+
// CHECK-SAME: elements: ![[PACK3_ELEMS:[0-9]+]]
47+
// CHECK: ![[PACK3_ELEMS]] = !{![[PACK3_ARGS:[0-9]+]]
48+
// CHECK-SAME: ![[PACK3_X:[0-9]+]]
49+
// CHECK-SAME: ![[PACK3_PARAMS:[0-9]+]]
50+
// CHECK-SAME: ![[PACK3_W:[0-9]+]]}
51+
// CHECK-DAG: ![[PACK3_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
52+
// CHECK-DAG: !DIDerivedType(tag: DW_TAG_reference_type
53+
// CHECK-DAG: ![[PACK3_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
54+
// CHECK-DAG: ![[PACK3_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
55+
// CHECK-DAG: ![[PACK3_W]] = !DIDerivedType(tag: DW_TAG_member, name: "w"
56+
// CHECK-NOT: DW_TAG_member
57+
58+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK4]]
59+
// CHECK-SAME: elements: ![[PACK4_ELEMS:[0-9]+]]
60+
// CHECK: ![[PACK4_ELEMS]] = !{![[PACK4_ARGS:[0-9]+]]
61+
// CHECK-SAME: ![[PACK4_ARGS]]
62+
// CHECK-SAME: ![[PACK4_X:[0-9]+]]
63+
// CHECK-SAME: ![[PACK4_PARAMS:[0-9]+]]
64+
// CHECK-SAME: ![[PACK4_PARAMS]]
65+
// CHECK-SAME: ![[PACK4_W:[0-9]+]]}
66+
// CHECK-DAG: ![[PACK4_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
67+
// CHECK-DAG: ![[PACK4_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
68+
// CHECK-DAG: ![[PACK4_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
69+
// CHECK-DAG: ![[PACK4_W]] = !DIDerivedType(tag: DW_TAG_member, name: "w"
70+
// CHECK-NOT: DW_TAG_member
71+
72+
struct Foo {
73+
template<typename... Args>
74+
auto capture_pack_and_this(Args... args) {
75+
auto val1 = [this, args..., ...params = args] {
76+
return w;
77+
}();
78+
79+
auto val2 = [args..., this, ...params = args] {
80+
return w;
81+
}();
82+
83+
auto val3 = [args..., ...params = args, this] {
84+
return w;
85+
}();
86+
87+
return val1 + val2 + val3;
88+
}
89+
90+
int w = 10;
91+
} f;
92+
93+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK5]]
94+
// CHECK-SAME: elements: ![[PACK5a_ELEMS:[0-9]+]]
95+
// CHECK: ![[PACK5a_ELEMS]] = !{![[PACK5a_THIS:[0-9]+]]
96+
// CHECK-SAME: ![[PACK5a_ARGS:[0-9]+]]
97+
// CHECK-SAME: ![[PACK5a_PARAMS:[0-9]+]]}
98+
// CHECK-DAG: ![[PACK5a_THIS]] = !DIDerivedType(tag: DW_TAG_member, name: "this"
99+
// CHECK-DAG: ![[PACK5a_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
100+
// CHECK-DAG: ![[PACK5a_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
101+
// CHECK-NOT: DW_TAG_member
102+
103+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK5]]
104+
// CHECK-SAME: elements: ![[PACK5b_ELEMS:[0-9]+]]
105+
// CHECK: ![[PACK5b_ELEMS]] = !{![[PACK5b_ARGS:[0-9]+]]
106+
// CHECK-SAME: ![[PACK5b_THIS:[0-9]+]]
107+
// CHECK-SAME: ![[PACK5b_PARAMS:[0-9]+]]}
108+
// CHECK-DAG: ![[PACK5b_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
109+
// CHECK-DAG: ![[PACK5b_THIS]] = !DIDerivedType(tag: DW_TAG_member, name: "this"
110+
// CHECK-DAG: ![[PACK5b_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
111+
// CHECK-NOT: DW_TAG_member
112+
113+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK5]]
114+
// CHECK: elements: ![[PACK5c_ELEMS:[0-9]+]]
115+
// CHECK-NEXT: ![[PACK5c_ELEMS]] = !{![[PACK5c_ARGS:[0-9]+]]
116+
// CHECK-SAME: ![[PACK5c_PARAMS:[0-9]+]]
117+
// CHECK-SAME: ![[PACK5c_THIS:[0-9]+]]}
118+
// CHECK-DAG: ![[PACK5c_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
119+
// CHECK-DAG: ![[PACK5c_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
120+
// CHECK-DAG: ![[PACK5c_THIS]] = !DIDerivedType(tag: DW_TAG_member, name: "this"
121+
// CHECK-NOT: DW_TAG_member
122+
123+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK6]]
124+
// CHECK-SAME: elements: ![[PACK6a_ELEMS:[0-9]+]]
125+
// CHECK: ![[PACK6a_ELEMS]] = !{![[PACK6a_THIS:[0-9]+]]
126+
// CHECK-SAME: ![[PACK6a_ARGS:[0-9]+]]
127+
// CHECK-SAME: ![[PACK6a_ARGS]]
128+
// CHECK-SAME: ![[PACK6a_PARAMS:[0-9]+]]
129+
// CHECK-SAME: ![[PACK6a_PARAMS]]
130+
// CHECK-DAG: ![[PACK6a_THIS]] = !DIDerivedType(tag: DW_TAG_member, name: "this"
131+
// CHECK-DAG: ![[PACK6a_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
132+
// CHECK-DAG: ![[PACK6a_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
133+
// CHECK-NOT: DW_TAG_member
134+
135+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK6]]
136+
// CHECK-SAME: elements: ![[PACK6b_ELEMS:[0-9]+]]
137+
// CHECK: ![[PACK6b_ELEMS]] = !{![[PACK6b_ARGS:[0-9]+]]
138+
// CHECK-SAME: ![[PACK6b_ARGS]]
139+
// CHECK-SAME: ![[PACK6b_THIS:[0-9]+]]
140+
// CHECK-SAME: ![[PACK6b_PARAMS:[0-9]+]]
141+
// CHECK-SAME: ![[PACK6b_PARAMS]]}
142+
// CHECK-DAG: ![[PACK6b_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
143+
// CHECK-DAG: ![[PACK6b_THIS]] = !DIDerivedType(tag: DW_TAG_member, name: "this"
144+
// CHECK-DAG: ![[PACK6b_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
145+
// CHECK-NOT: DW_TAG_member
146+
147+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK6]]
148+
// CHECK-SAME: elements: ![[PACK6c_ELEMS:[0-9]+]]
149+
// CHECK: ![[PACK6c_ELEMS]] = !{![[PACK6c_ARGS:[0-9]+]]
150+
// CHECK-SAME: ![[PACK6c_ARGS]]
151+
// CHECK-SAME: ![[PACK6c_PARAMS:[0-9]+]]
152+
// CHECK-SAME: ![[PACK6c_PARAMS]]
153+
// CHECK-SAME: ![[PACK6c_THIS:[0-9]+]]}
154+
// CHECK-DAG: ![[PACK6c_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
155+
// CHECK-DAG: ![[PACK6c_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
156+
// CHECK-DAG: ![[PACK6c_THIS]] = !DIDerivedType(tag: DW_TAG_member, name: "this"
157+
// CHECK-NOT: DW_TAG_member
158+
159+
template<typename... Args>
160+
auto capture_binding_and_param_pack(Args... args) {
161+
struct C { int x = 2; int y = 3; };
162+
163+
auto [x, ...e] = C();
164+
165+
return [&, args..., x, ...params = args,
166+
...es = e] {
167+
return e...[0] + es...[0];
168+
}();
169+
}
170+
171+
// CHECK: distinct !DICompositeType(tag: DW_TAG_structure_type, name: "C"
172+
// CHECK: distinct !DICompositeType(tag: DW_TAG_class_type, scope: ![[PACK7]]
173+
// CHECK-SAME: elements: ![[PACK7_ELEMS:[0-9]+]]
174+
// CHECK: ![[PACK7_ELEMS]] = !{![[PACK7_ARGS:[0-9]+]]
175+
// CHECK-SAME: ![[PACK7_ARGS]]
176+
// CHECK-SAME: ![[PACK7_X:[0-9]+]]
177+
// CHECK-SAME: ![[PACK7_PARAMS:[0-9]+]]
178+
// CHECK-SAME: ![[PACK7_PARAMS]]
179+
// CHECK-SAME: ![[PACK7_ES:[0-9]+]]
180+
// CHECK-SAME: ![[PACK7_E:[0-9]+]]}
181+
// CHECK-DAG: ![[PACK7_ARGS]] = !DIDerivedType(tag: DW_TAG_member, name: "args"
182+
// CHECK-DAG: ![[PACK7_X]] = !DIDerivedType(tag: DW_TAG_member, name: "x"
183+
// CHECK-DAG: ![[PACK7_PARAMS]] = !DIDerivedType(tag: DW_TAG_member, name: "params"
184+
// CHECK-DAG: ![[PACK7_ES]] = !DIDerivedType(tag: DW_TAG_member, name: "es"
185+
// CHECK-DAG: ![[PACK7_E]] = !DIDerivedType(tag: DW_TAG_member, name: "e"
186+
// CHECK-NOT: DW_TAG_member
187+
188+
int main() {
189+
return capture_pack(1)
190+
+ capture_pack(1, 2)
191+
+ capture_pack_and_locals(1, 2)
192+
+ capture_pack_and_locals(1, 2, 3)
193+
+ f.capture_pack_and_this(1)
194+
+ f.capture_pack_and_this(1, 2)
195+
+ capture_binding_and_param_pack(1, 2);
196+
}

compiler-rt/test/builtins/Unit/fixunstfdi_test.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
// XFAIL: target=aarch64-{{.*}}-windows-{{.*}}
21
// RUN: %clang_builtins %s %librt -o %t && %run %t
32
// REQUIRES: librt_has_fixunstfdi
43

54
#include <stdio.h>
65

7-
#if defined(CRT_HAS_TF_MODE)
8-
96
#include "int_lib.h"
107

8+
#if defined(CRT_HAS_TF_MODE)
9+
1110
// Returns: convert a to a unsigned long long, rounding toward zero.
1211
// Negative values all become zero.
1312

compiler-rt/test/builtins/Unit/multc3_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
// XFAIL: target=aarch64-{{.*}}-windows-{{.*}}
21
// RUN: %clang_builtins %s %librt -o %t && %run %t
32
// REQUIRES: librt_has_multc3
43

54
#include <stdio.h>
65

6+
#include "int_lib.h"
7+
78
#if defined(CRT_HAS_128BIT) && defined(CRT_HAS_F128)
89

9-
#include "int_lib.h"
1010
#include <math.h>
1111
#include <complex.h>
1212

lldb/packages/Python/lldbsuite/test/cpu_feature.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,13 @@ def _is_supported_linux(self, cmd_runner):
3939
if err.Fail() or retcode != 0:
4040
return output, False
4141

42-
# FIXME: simple substring match, e.g., test for 'sme' will be true if
43-
# 'sme2' or 'smefa64' is present
44-
return None, (self.cpu_info_flag in output)
42+
# Assume that every processor presents the same features.
43+
# Look for the first "Features: ...." line. Features are space separated.
44+
if m := re.search(r"Features\s*: (.*)\n", output):
45+
features = m.group(1).split()
46+
return None, (self.cpu_info_flag in features)
47+
48+
return 'No "Features:" line found in /proc/cpuinfo', False
4549

4650
def _is_supported_darwin(self, cmd_runner):
4751
if not self.sysctl_key:

lldb/test/Shell/ObjectFile/ELF/elf-no-shdrs-pt-notes.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
# RUN: -o "image list" \
1111
# RUN: | FileCheck %s
1212

13-
# CHECK: Current executable set to '{{.*/tools/lldb/test/Shell/ObjectFile/ELF/Output/elf-no-shdrs-pt-notes.yaml.tmp}}' (x86_64).
14-
# CHECK: [ 0] 7F1F56D6-7DBB-17BA-C9A3-4417DB52F097-2548414F 0x0000000000000000 {{.*/tools/lldb/test/Shell/ObjectFile/ELF/Output/elf-no-shdrs-pt-notes.yaml.tmp}}
13+
# CHECK: Current executable set to '{{.*}}elf-no-shdrs-pt-notes.yaml.tmp' (x86_64).
14+
# CHECK: [ 0] 7F1F56D6-7DBB-17BA-C9A3-4417DB52F097-2548414F 0x0000000000000000 {{.*}}elf-no-shdrs-pt-notes.yaml.tmp
1515

1616
--- !ELF
1717
FileHeader:

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,11 @@ class TargetTransformInfo {
16191619
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput,
16201620
bool UseMaskForCond = false, bool UseMaskForGaps = false) const;
16211621

1622+
/// \return The cost of vp intrinsic vp.load.ff.
1623+
LLVM_ABI InstructionCost getFirstFaultLoadCost(
1624+
Type *DataTy, Align Alignment,
1625+
TTI::TargetCostKind CostKind = TTI::TCK_RecipThroughput) const;
1626+
16221627
/// A helper function to determine the type of reduction algorithm used
16231628
/// for a given \p Opcode and set of FastMathFlags \p FMF.
16241629
static bool requiresOrderedReduction(std::optional<FastMathFlags> FMF) {

llvm/include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,12 @@ class TargetTransformInfoImplBase {
885885
return 1;
886886
}
887887

888+
virtual InstructionCost
889+
getFirstFaultLoadCost(Type *DataTy, Align Alignment,
890+
TTI::TargetCostKind CostKind) const {
891+
return InstructionCost::getInvalid();
892+
}
893+
888894
virtual InstructionCost
889895
getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
890896
TTI::TargetCostKind CostKind) const {

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1795,6 +1795,14 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
17951795
}
17961796
}
17971797

1798+
if (ICA.getID() == Intrinsic::vp_load_ff) {
1799+
Type *RetTy = ICA.getReturnType();
1800+
Type *DataTy = cast<StructType>(RetTy)->getElementType(0);
1801+
Align Alignment;
1802+
if (auto *VPI = dyn_cast_or_null<VPIntrinsic>(ICA.getInst()))
1803+
Alignment = VPI->getPointerAlignment().valueOrOne();
1804+
return thisT()->getFirstFaultLoadCost(DataTy, Alignment, CostKind);
1805+
}
17981806
if (ICA.getID() == Intrinsic::vp_scatter) {
17991807
if (ICA.isTypeBasedOnly()) {
18001808
IntrinsicCostAttributes MaskedScatter(

llvm/include/llvm/CodeGen/MachineBasicBlock.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ class MachineBasicBlock
505505
LLVM_ABI void removeLiveIn(MCRegister Reg,
506506
LaneBitmask LaneMask = LaneBitmask::getAll());
507507

508+
/// Remove the specified register from any overlapped live in. The method is
509+
/// subreg-aware and removes Reg and its subregs from the live in set. It also
510+
/// clears the corresponding bitmask from its live-in super registers.
511+
LLVM_ABI void removeLiveInOverlappedWith(MCRegister Reg);
512+
508513
/// Return true if the specified register is in the live in set.
509514
LLVM_ABI bool isLiveIn(MCRegister Reg,
510515
LaneBitmask LaneMask = LaneBitmask::getAll()) const;
@@ -1035,7 +1040,9 @@ class MachineBasicBlock
10351040
/// Succ, can be split. If this returns true a subsequent call to
10361041
/// SplitCriticalEdge is guaranteed to return a valid basic block if
10371042
/// no changes occurred in the meantime.
1038-
LLVM_ABI bool canSplitCriticalEdge(const MachineBasicBlock *Succ) const;
1043+
LLVM_ABI bool
1044+
canSplitCriticalEdge(const MachineBasicBlock *Succ,
1045+
const MachineLoopInfo *MLI = nullptr) const;
10391046

10401047
void pop_front() { Insts.pop_front(); }
10411048
void pop_back() { Insts.pop_back(); }

llvm/lib/Analysis/TargetTransformInfo.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,6 +1218,15 @@ InstructionCost TargetTransformInfo::getInterleavedMemoryOpCost(
12181218
return Cost;
12191219
}
12201220

1221+
InstructionCost
1222+
TargetTransformInfo::getFirstFaultLoadCost(Type *DataTy, Align Alignment,
1223+
TTI::TargetCostKind CostKind) const {
1224+
InstructionCost Cost =
1225+
TTIImpl->getFirstFaultLoadCost(DataTy, Alignment, CostKind);
1226+
assert(Cost >= 0 && "TTI should not produce negative costs!");
1227+
return Cost;
1228+
}
1229+
12211230
InstructionCost
12221231
TargetTransformInfo::getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
12231232
TTI::TargetCostKind CostKind) const {

0 commit comments

Comments
 (0)