Skip to content

Commit 13e299c

Browse files
author
Jenkins
committed
SWDEV-179954 - OpenCL/LC - Merge branch amd-master into amd-common
Change-Id: I6f53e3f39a35762583ac53cfef298d95a153f28e
2 parents 25e3c7c + 219d58c commit 13e299c

File tree

84 files changed

+2956
-1110
lines changed

Some content is hidden

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

84 files changed

+2956
-1110
lines changed

include/llvm/Analysis/TargetTransformInfoImpl.h

Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -144,50 +144,6 @@ class TargetTransformInfoImplBase {
144144
return TTI::TCC_Expensive;
145145
}
146146

147-
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
148-
ArrayRef<Type *> ParamTys, const User *U) {
149-
switch (IID) {
150-
default:
151-
// Intrinsics rarely (if ever) have normal argument setup constraints.
152-
// Model them as having a basic instruction cost.
153-
return TTI::TCC_Basic;
154-
155-
// TODO: other libc intrinsics.
156-
case Intrinsic::memcpy:
157-
return getMemcpyCost(dyn_cast<Instruction>(U));
158-
159-
case Intrinsic::annotation:
160-
case Intrinsic::assume:
161-
case Intrinsic::sideeffect:
162-
case Intrinsic::dbg_declare:
163-
case Intrinsic::dbg_value:
164-
case Intrinsic::dbg_label:
165-
case Intrinsic::invariant_start:
166-
case Intrinsic::invariant_end:
167-
case Intrinsic::launder_invariant_group:
168-
case Intrinsic::strip_invariant_group:
169-
case Intrinsic::is_constant:
170-
case Intrinsic::lifetime_start:
171-
case Intrinsic::lifetime_end:
172-
case Intrinsic::objectsize:
173-
case Intrinsic::ptr_annotation:
174-
case Intrinsic::var_annotation:
175-
case Intrinsic::experimental_gc_result:
176-
case Intrinsic::experimental_gc_relocate:
177-
case Intrinsic::coro_alloc:
178-
case Intrinsic::coro_begin:
179-
case Intrinsic::coro_free:
180-
case Intrinsic::coro_end:
181-
case Intrinsic::coro_frame:
182-
case Intrinsic::coro_size:
183-
case Intrinsic::coro_suspend:
184-
case Intrinsic::coro_param:
185-
case Intrinsic::coro_subfn_addr:
186-
// These intrinsics don't actually represent code after lowering.
187-
return TTI::TCC_Free;
188-
}
189-
}
190-
191147
bool hasBranchDivergence() { return false; }
192148

193149
bool isSourceOfDivergence(const Value *V) { return false; }
@@ -786,7 +742,49 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
786742
return TTI::TCC_Basic;
787743
}
788744

789-
using BaseT::getIntrinsicCost;
745+
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
746+
ArrayRef<Type *> ParamTys, const User *U) {
747+
switch (IID) {
748+
default:
749+
// Intrinsics rarely (if ever) have normal argument setup constraints.
750+
// Model them as having a basic instruction cost.
751+
return TTI::TCC_Basic;
752+
753+
// TODO: other libc intrinsics.
754+
case Intrinsic::memcpy:
755+
return static_cast<T *>(this)->getMemcpyCost(dyn_cast<Instruction>(U));
756+
757+
case Intrinsic::annotation:
758+
case Intrinsic::assume:
759+
case Intrinsic::sideeffect:
760+
case Intrinsic::dbg_declare:
761+
case Intrinsic::dbg_value:
762+
case Intrinsic::dbg_label:
763+
case Intrinsic::invariant_start:
764+
case Intrinsic::invariant_end:
765+
case Intrinsic::launder_invariant_group:
766+
case Intrinsic::strip_invariant_group:
767+
case Intrinsic::is_constant:
768+
case Intrinsic::lifetime_start:
769+
case Intrinsic::lifetime_end:
770+
case Intrinsic::objectsize:
771+
case Intrinsic::ptr_annotation:
772+
case Intrinsic::var_annotation:
773+
case Intrinsic::experimental_gc_result:
774+
case Intrinsic::experimental_gc_relocate:
775+
case Intrinsic::coro_alloc:
776+
case Intrinsic::coro_begin:
777+
case Intrinsic::coro_free:
778+
case Intrinsic::coro_end:
779+
case Intrinsic::coro_frame:
780+
case Intrinsic::coro_size:
781+
case Intrinsic::coro_suspend:
782+
case Intrinsic::coro_param:
783+
case Intrinsic::coro_subfn_addr:
784+
// These intrinsics don't actually represent code after lowering.
785+
return TTI::TCC_Free;
786+
}
787+
}
790788

791789
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
792790
ArrayRef<const Value *> Arguments, const User *U) {

lib/Analysis/MemorySSA.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ template <class AliasAnalysisType> class ClobberWalker {
665665
struct generic_def_path_iterator
666666
: public iterator_facade_base<generic_def_path_iterator<T, Walker>,
667667
std::forward_iterator_tag, T *> {
668-
generic_def_path_iterator() = default;
668+
generic_def_path_iterator() {}
669669
generic_def_path_iterator(Walker *W, ListIndex N) : W(W), N(N) {}
670670

671671
T &operator*() const { return curNode(); }

lib/CodeGen/MachineScheduler.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,13 +486,17 @@ getSchedRegions(MachineBasicBlock *MBB,
486486
MachineInstr &MI = *std::prev(I);
487487
if (isSchedBoundary(&MI, &*MBB, MF, TII))
488488
break;
489-
if (!MI.isDebugInstr())
489+
if (!MI.isDebugInstr()) {
490490
// MBB::size() uses instr_iterator to count. Here we need a bundle to
491491
// count as a single instruction.
492492
++NumRegionInstrs;
493+
}
493494
}
494495

495-
Regions.push_back(SchedRegion(I, RegionEnd, NumRegionInstrs));
496+
// It's possible we found a scheduling region that only has debug
497+
// instructions. Don't bother scheduling these.
498+
if (NumRegionInstrs != 0)
499+
Regions.push_back(SchedRegion(I, RegionEnd, NumRegionInstrs));
496500
}
497501

498502
if (RegionsTopDown)

lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,25 @@ void IntelJITEventListener::notifyObjectLoaded(
141141
uint64_t Addr = *AddrOrErr;
142142
uint64_t Size = P.second;
143143

144+
auto SecOrErr = Sym.getSection();
145+
if (!SecOrErr) {
146+
// TODO: Actually report errors helpfully.
147+
consumeError(SecOrErr.takeError());
148+
continue;
149+
}
150+
object::section_iterator Sec = *SecOrErr;
151+
if (Sec == Obj.section_end())
152+
continue;
153+
uint64_t Index = Sec->getIndex();
154+
144155
// Record this address in a local vector
145156
Functions.push_back((void*)Addr);
146157

147158
// Build the function loaded notification message
148159
iJIT_Method_Load FunctionMessage =
149160
FunctionDescToIntelJITFormat(*Wrapper, Name->data(), Addr, Size);
150-
// TODO: it is neccessary to set proper SectionIndex here.
151-
// object::SectionedAddress::UndefSection works for only absolute addresses.
152-
DILineInfoTable Lines = Context->getLineInfoForAddressRange({Addr, object::SectionedAddress::UndefSection}, Size);
161+
DILineInfoTable Lines =
162+
Context->getLineInfoForAddressRange({Addr, Index}, Size);
153163
DILineInfoTable::iterator Begin = Lines.begin();
154164
DILineInfoTable::iterator End = Lines.end();
155165
for (DILineInfoTable::iterator It = Begin; It != End; ++It) {

lib/ObjectYAML/MinidumpYAML.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,26 @@ class BlobAllocator {
1717
public:
1818
size_t tell() const { return NextOffset; }
1919

20-
size_t AllocateCallback(size_t Size,
20+
size_t allocateCallback(size_t Size,
2121
std::function<void(raw_ostream &)> Callback) {
2222
size_t Offset = NextOffset;
2323
NextOffset += Size;
2424
Callbacks.push_back(std::move(Callback));
2525
return Offset;
2626
}
2727

28-
size_t AllocateBytes(ArrayRef<uint8_t> Data) {
29-
return AllocateCallback(
28+
size_t allocateBytes(ArrayRef<uint8_t> Data) {
29+
return allocateCallback(
3030
Data.size(), [Data](raw_ostream &OS) { OS << toStringRef(Data); });
3131
}
3232

33-
template <typename T> size_t AllocateArray(ArrayRef<T> Data) {
34-
return AllocateBytes({reinterpret_cast<const uint8_t *>(Data.data()),
33+
template <typename T> size_t allocateArray(ArrayRef<T> Data) {
34+
return allocateBytes({reinterpret_cast<const uint8_t *>(Data.data()),
3535
sizeof(T) * Data.size()});
3636
}
3737

38-
template <typename T> size_t AllocateObject(const T &Data) {
39-
return AllocateArray(makeArrayRef(Data));
38+
template <typename T> size_t allocateObject(const T &Data) {
39+
return allocateArray(makeArrayRef(Data));
4040
}
4141

4242
void writeTo(raw_ostream &OS) const;
@@ -340,18 +340,18 @@ static Directory layout(BlobAllocator &File, Stream &S) {
340340
switch (S.Kind) {
341341
case Stream::StreamKind::RawContent: {
342342
RawContentStream &Raw = cast<RawContentStream>(S);
343-
File.AllocateCallback(Raw.Size, [&Raw](raw_ostream &OS) {
343+
File.allocateCallback(Raw.Size, [&Raw](raw_ostream &OS) {
344344
Raw.Content.writeAsBinary(OS);
345345
assert(Raw.Content.binary_size() <= Raw.Size);
346346
OS << std::string(Raw.Size - Raw.Content.binary_size(), '\0');
347347
});
348348
break;
349349
}
350350
case Stream::StreamKind::SystemInfo:
351-
File.AllocateObject(cast<SystemInfoStream>(S).Info);
351+
File.allocateObject(cast<SystemInfoStream>(S).Info);
352352
break;
353353
case Stream::StreamKind::TextContent:
354-
File.AllocateArray(arrayRefFromStringRef(cast<TextContentStream>(S).Text));
354+
File.allocateArray(arrayRefFromStringRef(cast<TextContentStream>(S).Text));
355355
break;
356356
}
357357
Result.Location.DataSize = File.tell() - Result.Location.RVA;
@@ -360,11 +360,11 @@ static Directory layout(BlobAllocator &File, Stream &S) {
360360

361361
void MinidumpYAML::writeAsBinary(Object &Obj, raw_ostream &OS) {
362362
BlobAllocator File;
363-
File.AllocateObject(Obj.Header);
363+
File.allocateObject(Obj.Header);
364364

365365
std::vector<Directory> StreamDirectory(Obj.Streams.size());
366366
Obj.Header.StreamDirectoryRVA =
367-
File.AllocateArray(makeArrayRef(StreamDirectory));
367+
File.allocateArray(makeArrayRef(StreamDirectory));
368368
Obj.Header.NumberOfStreams = StreamDirectory.size();
369369

370370
for (auto &Stream : enumerate(Obj.Streams))

lib/Target/AMDGPU/SIWholeQuadMode.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ class SIWholeQuadMode : public MachineFunctionPass {
200200

201201
void getAnalysisUsage(AnalysisUsage &AU) const override {
202202
AU.addRequired<LiveIntervals>();
203+
AU.addPreserved<SlotIndexes>();
204+
AU.addPreserved<LiveIntervals>();
203205
AU.setPreservesCFG();
204206
MachineFunctionPass::getAnalysisUsage(AU);
205207
}

lib/Target/ARM/ARMLegalizerInfo.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,13 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
129129

130130
// We're keeping these builders around because we'll want to add support for
131131
// floating point to them.
132-
auto &LoadStoreBuilder =
133-
getActionDefinitionsBuilder({G_LOAD, G_STORE})
134-
.legalForTypesWithMemDesc({
135-
{s1, p0, 8, 8},
136-
{s8, p0, 8, 8},
137-
{s16, p0, 16, 8},
138-
{s32, p0, 32, 8},
139-
{p0, p0, 32, 8}});
132+
auto &LoadStoreBuilder = getActionDefinitionsBuilder({G_LOAD, G_STORE})
133+
.legalForTypesWithMemDesc({{s1, p0, 8, 8},
134+
{s8, p0, 8, 8},
135+
{s16, p0, 16, 8},
136+
{s32, p0, 32, 8},
137+
{p0, p0, 32, 8}})
138+
.unsupportedIfMemSizeNotPow2();
140139

141140
getActionDefinitionsBuilder(G_FRAME_INDEX).legalFor({p0});
142141
getActionDefinitionsBuilder(G_GLOBAL_VALUE).legalFor({p0});
@@ -155,7 +154,9 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {
155154
{G_FADD, G_FSUB, G_FMUL, G_FDIV, G_FCONSTANT, G_FNEG})
156155
.legalFor({s32, s64});
157156

158-
LoadStoreBuilder.legalFor({{s64, p0}});
157+
LoadStoreBuilder
158+
.legalForTypesWithMemDesc({{s64, p0, 64, 32}})
159+
.maxScalar(0, s32);
159160
PhiBuilder.legalFor({s64});
160161

161162
getActionDefinitionsBuilder(G_FCMP).legalForCartesianProduct({s1},

0 commit comments

Comments
 (0)