Skip to content

Commit d15fa08

Browse files
SC llvm teamSC llvm team
authored andcommitted
Merged main:d230bf3fce6d into amd-gfx:da5edb4170fd
Local branch amd-gfx da5edb4 Merged main:12ee3a6f53db into amd-gfx:b62921ced91f Remote branch main d230bf3 [mlir][complex] Support Fastmath flag in the conversion of exp,expm1 (llvm#67001)
2 parents da5edb4 + d230bf3 commit d15fa08

File tree

25 files changed

+189
-122
lines changed

25 files changed

+189
-122
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ C++ Specific Potentially Breaking Changes
5151
parameter lists or requires-clauses. This causes mangled names to change for
5252
function templates in the following cases:
5353

54+
- When a template parameter in a function template depends on a previous
55+
template parameter, such as ``template<typename T, T V> void f()``.
5456
- When the function has any constraints, whether from constrained template
5557
parameters or requires-clauses.
5658
- When the template parameter list includes a deduced type -- either

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,8 +1901,7 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {
19011901
auto Overrides = MD->overridden_methods();
19021902
OS << "Overrides: [ ";
19031903
dumpOverride(*Overrides.begin());
1904-
for (const auto *Override :
1905-
llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
1904+
for (const auto *Override : llvm::drop_begin(Overrides)) {
19061905
OS << ", ";
19071906
dumpOverride(Override);
19081907
}

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,9 +1187,7 @@ class DSAStackTy {
11871187
if (!Top)
11881188
return false;
11891189

1190-
return llvm::any_of(Top->IteratorVarDecls, [VD](const VarDecl *IteratorVD) {
1191-
return IteratorVD == VD->getCanonicalDecl();
1192-
});
1190+
return llvm::is_contained(Top->IteratorVarDecls, VD->getCanonicalDecl());
11931191
}
11941192
/// get captured field from ImplicitDefaultFirstprivateFDs
11951193
VarDecl *getImplicitFDCapExprDecl(const FieldDecl *FD) const {

lldb/test/API/commands/watchpoints/step_over_watchpoint/TestStepOverWatchpoint.py

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test stepping over watchpoints."""
1+
"""Test stepping over watchpoints and instruction stepping past watchpoints."""
22

33

44
import lldb
@@ -11,11 +11,25 @@ class TestStepOverWatchpoint(TestBase):
1111
NO_DEBUG_INFO_TESTCASE = True
1212

1313
def get_to_start(self, bkpt_text):
14-
"""Test stepping over watchpoints."""
14+
"""Test stepping over watchpoints and instruction stepping past watchpoints.."""
1515
self.build()
1616
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
1717
self, bkpt_text, lldb.SBFileSpec("main.c")
1818
)
19+
return (target, process, thread, frame, read_watchpoint)
20+
21+
@add_test_categories(["basic_process"])
22+
@expectedFailureAll(
23+
oslist=["ios", "watchos", "tvos", "bridgeos", "macosx"],
24+
archs=["aarch64", "arm"],
25+
bugnumber="<rdar://problem/106868647>",
26+
)
27+
def test_step_over_read_watchpoint(self):
28+
self.build()
29+
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
30+
self, "break here for read watchpoints", lldb.SBFileSpec("main.c")
31+
)
32+
1933
frame = thread.GetFrameAtIndex(0)
2034
self.assertTrue(frame.IsValid(), "Failed to get frame.")
2135

@@ -33,14 +47,6 @@ def get_to_start(self, bkpt_text):
3347
# stepping off from the breakpoint:
3448
bkpt.SetEnabled(False)
3549

36-
return (target, process, thread, frame, read_watchpoint)
37-
38-
# Read-write watchpoints not supported on SystemZ
39-
@expectedFailureAll(archs=["s390x"])
40-
@add_test_categories(["basic_process"])
41-
def test_step_over(self):
42-
target, process, thread, frame, wp = self.get_to_start("Set a breakpoint here")
43-
4450
thread.StepOver()
4551
self.assertStopReason(
4652
thread.GetStopReason(),
@@ -49,39 +55,36 @@ def test_step_over(self):
4955
)
5056
self.assertEquals(thread.GetStopDescription(20), "watchpoint 1")
5157

52-
# Skip everywhere while modify watchpoints are sorted out.
53-
@skipTestIfFn(lambda : True)
54-
@expectedFailureAll(
55-
oslist=["freebsd", "linux"],
56-
archs=["aarch64", "arm"],
57-
bugnumber="llvm.org/pr26031",
58-
)
59-
# Read-write watchpoints not supported on SystemZ
60-
@expectedFailureAll(archs=["s390x"])
58+
process.Continue()
59+
self.assertState(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
60+
self.assertEquals(thread.GetStopDescription(20), "step over")
61+
62+
self.step_inst_for_watchpoint(1)
63+
64+
@add_test_categories(["basic_process"])
6165
@expectedFailureAll(
6266
oslist=["ios", "watchos", "tvos", "bridgeos", "macosx"],
6367
archs=["aarch64", "arm"],
64-
bugnumber="<rdar://problem/34027183>",
68+
bugnumber="<rdar://problem/106868647>",
6569
)
66-
@add_test_categories(["basic_process"])
67-
def test_step_instruction(self):
68-
target, process, thread, frame, wp = self.get_to_start(
69-
"Set breakpoint after call"
70+
def test_step_over_write_watchpoint(self):
71+
self.build()
72+
target, process, thread, bkpt = lldbutil.run_to_source_breakpoint(
73+
self, "break here for modify watchpoints", lldb.SBFileSpec("main.c")
7074
)
7175

72-
self.step_inst_for_watchpoint(1)
76+
# Disable the breakpoint we hit so we don't muddy the waters with
77+
# stepping off from the breakpoint:
78+
bkpt.SetEnabled(False)
79+
80+
frame = thread.GetFrameAtIndex(0)
81+
self.assertTrue(frame.IsValid(), "Failed to get frame.")
7382

7483
write_value = frame.FindValue("g_watch_me_write", lldb.eValueTypeVariableGlobal)
7584
self.assertTrue(write_value, "Failed to find write value.")
7685

77-
# Most of the MIPS boards provide only one H/W watchpoints, and S/W
78-
# watchpoints are not supported yet
79-
arch = self.getArchitecture()
80-
if re.match("^mips", arch) or re.match("powerpc64le", arch):
81-
self.runCmd("watchpoint delete 1")
82-
8386
error = lldb.SBError()
84-
# resolve_location=True, read=False, write=True
87+
# resolve_location=True, read=False, modify=True
8588
write_watchpoint = write_value.Watch(True, False, True, error)
8689
self.assertTrue(write_watchpoint, "Failed to set write watchpoint.")
8790
self.assertSuccess(error, "Error while setting watchpoint")
@@ -92,13 +95,13 @@ def test_step_instruction(self):
9295
lldb.eStopReasonWatchpoint,
9396
STOPPED_DUE_TO_WATCHPOINT,
9497
)
95-
self.assertEquals(thread.GetStopDescription(20), "watchpoint 2")
98+
self.assertEquals(thread.GetStopDescription(20), "watchpoint 1")
9699

97100
process.Continue()
98101
self.assertState(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
99102
self.assertEquals(thread.GetStopDescription(20), "step over")
100103

101-
self.step_inst_for_watchpoint(2)
104+
self.step_inst_for_watchpoint(1)
102105

103106
def step_inst_for_watchpoint(self, wp_id):
104107
watchpoint_hit = False

lldb/test/API/commands/watchpoints/step_over_watchpoint/main.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,20 @@ void watch_read() {
66
g_temp = g_watch_me_read;
77
}
88

9-
void watch_write() {
10-
g_watch_me_write = g_temp;
9+
void watch_write() { g_watch_me_write = g_temp++; }
10+
11+
void read_watchpoint_testing() {
12+
watch_read(); // break here for read watchpoints
13+
g_temp = g_watch_me_read;
14+
}
15+
16+
void watch_breakpoint_testing() {
17+
watch_write(); // break here for modify watchpoints
18+
g_watch_me_write = g_temp;
1119
}
1220

1321
int main() {
14-
watch_read(); // Set a breakpoint here
15-
g_temp = g_watch_me_read; // Set breakpoint after call
16-
watch_write();
17-
g_watch_me_write = g_temp + 1;
18-
return 0;
22+
read_watchpoint_testing();
23+
watch_breakpoint_testing();
24+
return 0;
1925
}

llvm/include/llvm/Config/llvm-config.h.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
/* Indicate that this is LLVM compiled from the amd-gfx branch. */
1818
#define LLVM_HAVE_BRANCH_AMD_GFX
19-
#define LLVM_MAIN_REVISION 475709
19+
#define LLVM_MAIN_REVISION 475719
2020

2121
/* Define if LLVM_ENABLE_DUMP is enabled */
2222
#cmakedefine LLVM_ENABLE_DUMP

llvm/lib/CodeGen/GlobalISel/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ llvm::getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI) {
11731173
if (auto Splat = getIConstantSplatSExtVal(MI, MRI))
11741174
return RegOrConstant(*Splat);
11751175
auto Reg = MI.getOperand(1).getReg();
1176-
if (any_of(make_range(MI.operands_begin() + 2, MI.operands_end()),
1176+
if (any_of(drop_begin(MI.operands(), 2),
11771177
[&Reg](const MachineOperand &Op) { return Op.getReg() != Reg; }))
11781178
return std::nullopt;
11791179
return RegOrConstant(Reg);

llvm/lib/CodeGen/MachineCopyPropagation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,11 +1147,11 @@ void MachineCopyPropagation::EliminateSpillageCopies(MachineBasicBlock &MBB) {
11471147
return;
11481148

11491149
// If violate property#2, we don't fold the chain.
1150-
for (const MachineInstr *Spill : make_range(SC.begin() + 1, SC.end()))
1150+
for (const MachineInstr *Spill : drop_begin(SC))
11511151
if (CopySourceInvalid.count(Spill))
11521152
return;
11531153

1154-
for (const MachineInstr *Reload : make_range(RC.begin(), RC.end() - 1))
1154+
for (const MachineInstr *Reload : drop_end(RC))
11551155
if (CopySourceInvalid.count(Reload))
11561156
return;
11571157

llvm/lib/ExecutionEngine/JITLink/ELF_riscv.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,7 @@ static RelaxAux initRelaxAux(LinkGraph &G) {
516516
RelaxAux Aux;
517517
Aux.Config.IsRV32 = G.getTargetTriple().isRISCV32();
518518
const auto &Features = G.getFeatures().getFeatures();
519-
Aux.Config.HasRVC =
520-
std::find(Features.begin(), Features.end(), "+c") != Features.end();
519+
Aux.Config.HasRVC = llvm::is_contained(Features, "+c");
521520

522521
for (auto &S : G.sections()) {
523522
if (!shouldRelax(S))

llvm/lib/IR/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {
130130
// clients might not expect this to happen. The code as it is thrashes the
131131
// use/def lists, which is kinda lame.
132132
std::copy(op_begin() + Idx + 1, op_end(), op_begin() + Idx);
133-
copyIncomingBlocks(make_range(block_begin() + Idx + 1, block_end()), Idx);
133+
copyIncomingBlocks(drop_begin(blocks(), Idx + 1), Idx);
134134

135135
// Nuke the last value.
136136
Op<-1>().set(nullptr);

llvm/lib/MCA/Stages/EntryStage.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ llvm::Error EntryStage::cycleResume() {
6767

6868
llvm::Error EntryStage::cycleEnd() {
6969
// Find the first instruction which hasn't been retired.
70-
auto Range =
71-
make_range(Instructions.begin() + NumRetired, Instructions.end());
70+
auto Range = drop_begin(Instructions, NumRetired);
7271
auto It = find_if(Range, [](const std::unique_ptr<Instruction> &I) {
7372
return !I->isRetired();
7473
});

llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,11 +1053,9 @@ bool AArch64ExpandPseudo::expandMultiVecPseudo(
10531053
auto ContiguousRange = ContiguousClass.getRegisters();
10541054
auto StridedRange = StridedClass.getRegisters();
10551055
unsigned Opc;
1056-
if ((std::find(ContiguousRange.begin(), ContiguousRange.end(),
1057-
Tuple.asMCReg()) != std::end(ContiguousRange))) {
1056+
if (llvm::is_contained(ContiguousRange, Tuple.asMCReg())) {
10581057
Opc = ContiguousOp;
1059-
} else if ((std::find(StridedRange.begin(), StridedRange.end(),
1060-
Tuple.asMCReg()) != std::end(StridedRange))) {
1058+
} else if (llvm::is_contained(StridedRange, Tuple.asMCReg())) {
10611059
Opc = StridedOpc;
10621060
} else
10631061
llvm_unreachable("Cannot expand Multi-Vector pseudo");

llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5517,11 +5517,9 @@ bool AArch64InstructionSelector::tryOptBuildVecToSubregToReg(
55175517
const RegisterBank &DstRB = *RBI.getRegBank(Dst, MRI, TRI);
55185518
if (EltRB != DstRB)
55195519
return false;
5520-
if (any_of(make_range(I.operands_begin() + 2, I.operands_end()),
5521-
[&MRI](const MachineOperand &Op) {
5522-
return !getOpcodeDef(TargetOpcode::G_IMPLICIT_DEF, Op.getReg(),
5523-
MRI);
5524-
}))
5520+
if (any_of(drop_begin(I.operands(), 2), [&MRI](const MachineOperand &Op) {
5521+
return !getOpcodeDef(TargetOpcode::G_IMPLICIT_DEF, Op.getReg(), MRI);
5522+
}))
55255523
return false;
55265524
unsigned SubReg;
55275525
const TargetRegisterClass *EltRC = getRegClassForTypeOnBank(EltTy, EltRB);

llvm/lib/Target/AMDGPU/AMDGPUIGroupLP.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,8 +1152,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
11521152
if (Pred.getSUnit()->getInstr()->getOpcode() != AMDGPU::V_PERM_B32_e64)
11531153
continue;
11541154

1155-
if (Cand &&
1156-
std::find(Counted.begin(), Counted.end(), Cand) != Counted.end())
1155+
if (Cand && llvm::is_contained(Counted, Cand))
11571156
break;
11581157

11591158
for (auto &Succ : Pred.getSUnit()->Succs) {
@@ -1174,7 +1173,7 @@ void MFMASmallGemmSingleWaveOpt::applyIGLPStrategy(
11741173
}
11751174

11761175
Cand = VMEMLookup[MI];
1177-
if (std::find(Counted.begin(), Counted.end(), Cand) != Counted.end()) {
1176+
if (llvm::is_contained(Counted, Cand)) {
11781177
MissedAny = true;
11791178
break;
11801179
}

llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,7 @@ bool SILowerSGPRSpills::runOnMachineFunction(MachineFunction &MF) {
355355
int FI = TII->getNamedOperand(MI, AMDGPU::OpName::addr)->getIndex();
356356
assert(MFI.getStackID(FI) == TargetStackID::SGPRSpill);
357357

358-
bool IsCalleeSaveSGPRSpill =
359-
std::find(CalleeSavedFIs.begin(), CalleeSavedFIs.end(), FI) !=
360-
CalleeSavedFIs.end();
358+
bool IsCalleeSaveSGPRSpill = llvm::is_contained(CalleeSavedFIs, FI);
361359
if (IsCalleeSaveSGPRSpill) {
362360
// Spill callee-saved SGPRs into physical VGPR lanes.
363361

llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,9 +228,7 @@ bool RISCVInstructionSelector::select(MachineInstr &MI) {
228228
MI.setDesc(TII.get(TargetOpcode::COPY));
229229
return true;
230230
case TargetOpcode::G_CONSTANT:
231-
if (!selectConstant(MI, MIB, MRI))
232-
return false;
233-
break;
231+
return selectConstant(MI, MIB, MRI);
234232
case TargetOpcode::G_BRCOND: {
235233
// TODO: Fold with G_ICMP.
236234
auto Bcc =
@@ -242,10 +240,6 @@ bool RISCVInstructionSelector::select(MachineInstr &MI) {
242240
default:
243241
return false;
244242
}
245-
246-
MI.eraseFromParent();
247-
248-
return true;
249243
}
250244

251245
void RISCVInstructionSelector::renderNegImm(MachineInstrBuilder &MIB,
@@ -312,6 +306,13 @@ bool RISCVInstructionSelector::selectConstant(MachineInstr &MI,
312306
Register FinalReg = MI.getOperand(0).getReg();
313307
int64_t Imm = MI.getOperand(1).getCImm()->getSExtValue();
314308

309+
if (Imm == 0) {
310+
MI.getOperand(1).ChangeToRegister(RISCV::X0, false);
311+
RBI.constrainGenericRegister(FinalReg, RISCV::GPRRegClass, MRI);
312+
MI.setDesc(TII.get(TargetOpcode::COPY));
313+
return true;
314+
}
315+
315316
RISCVMatInt::InstSeq Seq =
316317
RISCVMatInt::generateInstSeq(Imm, Subtarget->getFeatureBits());
317318
unsigned NumInsts = Seq.size();
@@ -358,6 +359,7 @@ bool RISCVInstructionSelector::selectConstant(MachineInstr &MI,
358359
SrcReg = DstReg;
359360
}
360361

362+
MI.eraseFromParent();
361363
return true;
362364
}
363365

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,8 +3126,7 @@ class llvm::sroa::AllocaSliceRewriter
31263126
if (IsDest) {
31273127
// Update the address component of linked dbg.assigns.
31283128
for (auto *DAI : at::getAssignmentMarkers(&II)) {
3129-
if (any_of(DAI->location_ops(),
3130-
[&](Value *V) { return V == II.getDest(); }) ||
3129+
if (llvm::is_contained(DAI->location_ops(), II.getDest()) ||
31313130
DAI->getAddress() == II.getDest())
31323131
DAI->replaceVariableLocationOp(II.getDest(), AdjustedPtr);
31333132
}

0 commit comments

Comments
 (0)