Skip to content

Commit 760cdaf

Browse files
authored
Merge branch 'release/rocm-rel-6.4' into zichguan/cherrypick-cstdint-fix2
2 parents a6dc0cc + 26a1801 commit 760cdaf

File tree

53 files changed

+2391
-407
lines changed

Some content is hidden

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

53 files changed

+2391
-407
lines changed

clang/include/clang/Driver/Options.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4457,8 +4457,8 @@ def gheterogeneous_dwarf_EQ : Joined<["-"], "gheterogeneous-dwarf=">,
44574457
MarshallingInfoEnum<CodeGenOpts<"HeterogeneousDwarfMode">, "Disabled">;
44584458
def gheterogeneous_dwarf : Flag<["-"], "gheterogeneous-dwarf">, Group<g_Group>,
44594459
Visibility<[ClangOption, CC1Option]>,
4460-
HelpText<"Enable DIExpr-based DWARF extensions for heterogeneous debugging">,
4461-
Alias<gheterogeneous_dwarf_EQ>, AliasArgs<["diexpr"]>;
4460+
HelpText<"Enable DIExpression-based DWARF extensions for heterogeneous debugging">,
4461+
Alias<gheterogeneous_dwarf_EQ>, AliasArgs<["diexpression"]>;
44624462
def gno_heterogeneous_dwarf : Flag<["-"], "gno-heterogeneous-dwarf">,
44634463
Visibility<[ClangOption, CC1Option]>,
44644464
Group<g_Group>,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4840,11 +4840,12 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
48404840
assert(Aliased.isValid() && "gheterogeneous-dwarf must be an alias");
48414841
assert(Aliased.getName() == "gheterogeneous-dwarf=" &&
48424842
"gheterogeneous-dwarf must alias gheterogeneous-dwarf=");
4843-
assert(StringRef(GHeterogeneousDwarf.getAliasArgs()) == "diexpr" &&
4844-
GHeterogeneousDwarf.getAliasArgs()[strlen("diexpr") + 1] == '\0' &&
4845-
"gheterogeneous-dwarf must alias gheterogeneous-dwarf=diexpr");
4843+
assert(StringRef(GHeterogeneousDwarf.getAliasArgs()) == "diexpression" &&
4844+
GHeterogeneousDwarf.getAliasArgs()[strlen("diexpression") + 1] ==
4845+
'\0' &&
4846+
"gheterogeneous-dwarf must alias gheterogeneous-dwarf=diexpression");
48464847
#endif
4847-
CmdArgs.push_back("-gheterogeneous-dwarf=diexpr");
4848+
CmdArgs.push_back("-gheterogeneous-dwarf=diexpression");
48484849
}
48494850

48504851
// This controls whether or not we perform JustMyCode instrumentation.

clang/test/CodeGenHIP/debug-info-cc1-option.hip

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
// and aliases the new default. This is needed for transitioning flang-legacy
66
// as it depends on the -cc1 interface.
77

8-
// CHECK: call void @llvm.dbg.def
9-
// CHECK: !DIExpr(
8+
// CHECK: #dbg_declare{{.*}}DIExpression{{.*}}DIOp
109
__attribute__((device)) void kernel1(int Arg) {
1110
int FuncVar;
1211
}

clang/test/Driver/amdgpu-debug.cl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// CHECK-SIMPLE-NOT: "-disable-O0-optnone"
88
// CHECK-SIMPLE-NOT: "-debug-info-kind=line-tables-only"
99
// CHECK-SIMPLE-DAG: "-mllvm" "-amdgpu-spill-cfi-saved-regs"
10-
// CHECK-SIMPLE-DAG: "-gheterogeneous-dwarf=diexpr"
10+
// CHECK-SIMPLE-DAG: "-gheterogeneous-dwarf=diexpression"
1111
// CHECK-SIMPLE-DAG: "-debugger-tuning=gdb"
1212
// CHECK-SIMPLE-NOT: "-disable-O0-optnone"
1313
// CHECK-SIMPLE-NOT: "-debug-info-kind=line-tables-only"
@@ -21,7 +21,7 @@
2121
// Check that -gheterogeneous-dwarf can be enabled for non-AMDGCN
2222
// RUN: %clang -### -target x86_64-linux-gnu -x cl -c -nogpuinc -nogpulib -emit-llvm -gheterogeneous-dwarf %s 2>&1 | FileCheck -check-prefix=CHECK-EXPLICIT-HETEROGENEOUS %s
2323
// CHECK-EXPLICIT-HETEROGENEOUS: "-cc1"
24-
// CHECK-EXPLICIT-HETEROGENEOUS: "-gheterogeneous-dwarf=diexpr"
24+
// CHECK-EXPLICIT-HETEROGENEOUS: "-gheterogeneous-dwarf=diexpression"
2525

2626
// Check that -gheterogeneous-dwarf can be disabled for AMDGCN
2727
// RUN: %clang -### -target amdgcn-amd-amdhsa -x cl -c -nogpuinc -nogpulib -emit-llvm -g -gno-heterogeneous-dwarf %s 2>&1 | FileCheck -check-prefix=CHECK-NO-HETEROGENEOUS %s

llvm/include/llvm/CodeGen/MachineFunction.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction {
592592
void substituteDebugValuesForInst(const MachineInstr &Old, MachineInstr &New,
593593
unsigned MaxOperand = UINT_MAX);
594594

595+
using SalvageCopySSAResult = std::pair<DebugInstrOperandPair, MachineInstr *>;
596+
595597
/// Find the underlying defining instruction / operand for a COPY instruction
596598
/// while in SSA form. Copies do not actually define values -- they move them
597599
/// between registers. Labelling a COPY-like instruction with an instruction
@@ -603,11 +605,11 @@ class LLVM_EXTERNAL_VISIBILITY MachineFunction {
603605
/// \p MI The copy-like instruction to salvage.
604606
/// \p DbgPHICache A container to cache already-solved COPYs.
605607
/// \returns An instruction/operand pair identifying the defining value.
606-
DebugInstrOperandPair
608+
SalvageCopySSAResult
607609
salvageCopySSA(MachineInstr &MI,
608-
DenseMap<Register, DebugInstrOperandPair> &DbgPHICache);
610+
DenseMap<Register, SalvageCopySSAResult> &DbgPHICache);
609611

610-
DebugInstrOperandPair salvageCopySSAImpl(MachineInstr &MI);
612+
SalvageCopySSAResult salvageCopySSAImpl(MachineInstr &MI);
611613

612614
/// Finalise any partially emitted debug instructions. These are DBG_INSTR_REF
613615
/// instructions where we only knew the vreg of the value they use, not the

llvm/include/llvm/CodeGen/TargetSchedule.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ class TargetSchedModel {
4545

4646
unsigned computeInstrLatency(const MCSchedClassDesc &SCDesc) const;
4747

48+
// EnableSchedModel and EnableSchedItins are used to control whether or not to
49+
// use the Target's {SchedMachineModel, InstrItins} for hardware infor based
50+
// Scheduling decisions. If both are enabled, as is the default, preference
51+
// will be given to one based on the API implementation. By disabling one, we
52+
// can force preference of the other. By disabling both, we will throw away
53+
// any target specific hardware details for scheduling decisions, and fall
54+
// into things that provide generic info such as defaultDefLatency.
55+
bool EnableSchedModel = true;
56+
bool EnableSchedItins = true;
57+
4858
public:
4959
TargetSchedModel() : SchedModel(MCSchedModel::Default) {}
5060

@@ -53,7 +63,8 @@ class TargetSchedModel {
5363
/// The machine model API keeps a copy of the top-level MCSchedModel table
5464
/// indices and may query TargetSubtargetInfo and TargetInstrInfo to resolve
5565
/// dynamic properties.
56-
void init(const TargetSubtargetInfo *TSInfo);
66+
void init(const TargetSubtargetInfo *TSInfo, bool EnableSModel = true,
67+
bool EnableSItins = true);
5768

5869
/// Return the MCSchedClassDesc for this instruction.
5970
const MCSchedClassDesc *resolveSchedClass(const MachineInstr *MI) const;

llvm/include/llvm/IR/DebugInfoMetadata.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,6 +1098,12 @@ class DIDerivedType : public DIType {
10981098

10991099
TempDIDerivedType clone() const { return cloneImpl(); }
11001100

1101+
TempDIDerivedType cloneWithAddressSpace(unsigned DWARFAddrSpace) const {
1102+
auto Tmp = clone();
1103+
Tmp->DWARFAddressSpace = DWARFAddrSpace;
1104+
return Tmp;
1105+
}
1106+
11011107
/// Get the base type this is derived from.
11021108
DIType *getBaseType() const { return cast_or_null<DIType>(getRawBaseType()); }
11031109
Metadata *getRawBaseType() const { return getOperand(3); }
@@ -3345,6 +3351,19 @@ class DIExpression : public MDNode {
33453351
element_iterator elements_begin() const { return getElements().begin(); }
33463352
element_iterator elements_end() const { return getElements().end(); }
33473353

3354+
/// Returns the pointer address space this DIOp-based DIExpression produces.
3355+
/// Note that this may diverge from the the pointer address space of the
3356+
/// result type. When there is a divergent address space, the DIExpression
3357+
/// must produce a generic pointer whose value can be proven to belong to a
3358+
/// more specific address space. For instance in this expression, this
3359+
/// function returns 4:
3360+
///
3361+
/// !DIExpression(DIOpArg(0, ptr addrspace(4)), DIOpConvert(ptr))
3362+
///
3363+
/// A divergent address space can be created by a DIOpConvert, and is
3364+
/// preserved across DIOpReinterpret.
3365+
std::optional<unsigned> getNewDivergentAddrSpace() const;
3366+
33483367
/// A lightweight wrapper around an expression operand.
33493368
///
33503369
/// TODO: Store arguments directly and change \a DIExpression to store a

llvm/include/llvm/Transforms/Utils/Local.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ Value *salvageDebugInfoImpl(Instruction &I, uint64_t CurrentLocOps,
356356
/// introducing a use-before-def, it is either salvaged (\ref salvageDebugInfo)
357357
/// or deleted. Returns true if any debug users were updated.
358358
bool replaceAllDbgUsesWith(Instruction &From, Value &To, Instruction &DomPoint,
359-
DominatorTree &DT);
359+
const DominatorTree &DT);
360360

361361
/// If a terminator in an unreachable basic block has an operand of type
362362
/// Instruction, transform it into poison. Return true if any operands

llvm/lib/CodeGen/AsmPrinter/DebugLocStream.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ void DebugLocStream::finalizeEntry() {
4040
DebugLocStream::ListBuilder::~ListBuilder() {
4141
if (!Locs.finalizeList(Asm))
4242
return;
43-
V.emplace<Loc::Multi>(ListIndex, TagOffset);
43+
V.emplace<Loc::Multi>(ListIndex, TagOffset, CommonAddrSpace);
4444
}

llvm/lib/CodeGen/AsmPrinter/DebugLocStream.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ class DebugLocStream::ListBuilder {
157157
DbgVariable &V;
158158
size_t ListIndex;
159159
std::optional<uint8_t> TagOffset;
160+
std::optional<unsigned> CommonAddrSpace;
160161

161162
public:
162163
ListBuilder(DebugLocStream &Locs, DwarfCompileUnit &CU, AsmPrinter &Asm,
@@ -168,6 +169,11 @@ class DebugLocStream::ListBuilder {
168169
TagOffset = TO;
169170
}
170171

172+
void setCommonDivergentAddrSpace(unsigned AS) { CommonAddrSpace = AS; }
173+
bool hasCommonDivergentAddrSpace() const {
174+
return CommonAddrSpace != std::nullopt;
175+
}
176+
171177
/// Finalize the list.
172178
///
173179
/// If the list is empty, delete it. Otherwise, finalize it by creating a

0 commit comments

Comments
 (0)