Skip to content

Commit

Permalink
SWDEV-179954 - OpenCL/LC - Merge branch amd-master into amd-common
Browse files Browse the repository at this point in the history
Change-Id: I6f53e3f39a35762583ac53cfef298d95a153f28e
  • Loading branch information
Jenkins committed Mar 26, 2019
2 parents 25e3c7c + 219d58c commit 13e299c
Show file tree
Hide file tree
Showing 84 changed files with 2,956 additions and 1,110 deletions.
88 changes: 43 additions & 45 deletions include/llvm/Analysis/TargetTransformInfoImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,50 +144,6 @@ class TargetTransformInfoImplBase {
return TTI::TCC_Expensive;
}

unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
ArrayRef<Type *> ParamTys, const User *U) {
switch (IID) {
default:
// Intrinsics rarely (if ever) have normal argument setup constraints.
// Model them as having a basic instruction cost.
return TTI::TCC_Basic;

// TODO: other libc intrinsics.
case Intrinsic::memcpy:
return getMemcpyCost(dyn_cast<Instruction>(U));

case Intrinsic::annotation:
case Intrinsic::assume:
case Intrinsic::sideeffect:
case Intrinsic::dbg_declare:
case Intrinsic::dbg_value:
case Intrinsic::dbg_label:
case Intrinsic::invariant_start:
case Intrinsic::invariant_end:
case Intrinsic::launder_invariant_group:
case Intrinsic::strip_invariant_group:
case Intrinsic::is_constant:
case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end:
case Intrinsic::objectsize:
case Intrinsic::ptr_annotation:
case Intrinsic::var_annotation:
case Intrinsic::experimental_gc_result:
case Intrinsic::experimental_gc_relocate:
case Intrinsic::coro_alloc:
case Intrinsic::coro_begin:
case Intrinsic::coro_free:
case Intrinsic::coro_end:
case Intrinsic::coro_frame:
case Intrinsic::coro_size:
case Intrinsic::coro_suspend:
case Intrinsic::coro_param:
case Intrinsic::coro_subfn_addr:
// These intrinsics don't actually represent code after lowering.
return TTI::TCC_Free;
}
}

bool hasBranchDivergence() { return false; }

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

using BaseT::getIntrinsicCost;
unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
ArrayRef<Type *> ParamTys, const User *U) {
switch (IID) {
default:
// Intrinsics rarely (if ever) have normal argument setup constraints.
// Model them as having a basic instruction cost.
return TTI::TCC_Basic;

// TODO: other libc intrinsics.
case Intrinsic::memcpy:
return static_cast<T *>(this)->getMemcpyCost(dyn_cast<Instruction>(U));

case Intrinsic::annotation:
case Intrinsic::assume:
case Intrinsic::sideeffect:
case Intrinsic::dbg_declare:
case Intrinsic::dbg_value:
case Intrinsic::dbg_label:
case Intrinsic::invariant_start:
case Intrinsic::invariant_end:
case Intrinsic::launder_invariant_group:
case Intrinsic::strip_invariant_group:
case Intrinsic::is_constant:
case Intrinsic::lifetime_start:
case Intrinsic::lifetime_end:
case Intrinsic::objectsize:
case Intrinsic::ptr_annotation:
case Intrinsic::var_annotation:
case Intrinsic::experimental_gc_result:
case Intrinsic::experimental_gc_relocate:
case Intrinsic::coro_alloc:
case Intrinsic::coro_begin:
case Intrinsic::coro_free:
case Intrinsic::coro_end:
case Intrinsic::coro_frame:
case Intrinsic::coro_size:
case Intrinsic::coro_suspend:
case Intrinsic::coro_param:
case Intrinsic::coro_subfn_addr:
// These intrinsics don't actually represent code after lowering.
return TTI::TCC_Free;
}
}

unsigned getIntrinsicCost(Intrinsic::ID IID, Type *RetTy,
ArrayRef<const Value *> Arguments, const User *U) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Analysis/MemorySSA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ template <class AliasAnalysisType> class ClobberWalker {
struct generic_def_path_iterator
: public iterator_facade_base<generic_def_path_iterator<T, Walker>,
std::forward_iterator_tag, T *> {
generic_def_path_iterator() = default;
generic_def_path_iterator() {}
generic_def_path_iterator(Walker *W, ListIndex N) : W(W), N(N) {}

T &operator*() const { return curNode(); }
Expand Down
8 changes: 6 additions & 2 deletions lib/CodeGen/MachineScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,17 @@ getSchedRegions(MachineBasicBlock *MBB,
MachineInstr &MI = *std::prev(I);
if (isSchedBoundary(&MI, &*MBB, MF, TII))
break;
if (!MI.isDebugInstr())
if (!MI.isDebugInstr()) {
// MBB::size() uses instr_iterator to count. Here we need a bundle to
// count as a single instruction.
++NumRegionInstrs;
}
}

Regions.push_back(SchedRegion(I, RegionEnd, NumRegionInstrs));
// It's possible we found a scheduling region that only has debug
// instructions. Don't bother scheduling these.
if (NumRegionInstrs != 0)
Regions.push_back(SchedRegion(I, RegionEnd, NumRegionInstrs));
}

if (RegionsTopDown)
Expand Down
16 changes: 13 additions & 3 deletions lib/ExecutionEngine/IntelJITEvents/IntelJITEventListener.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,25 @@ void IntelJITEventListener::notifyObjectLoaded(
uint64_t Addr = *AddrOrErr;
uint64_t Size = P.second;

auto SecOrErr = Sym.getSection();
if (!SecOrErr) {
// TODO: Actually report errors helpfully.
consumeError(SecOrErr.takeError());
continue;
}
object::section_iterator Sec = *SecOrErr;
if (Sec == Obj.section_end())
continue;
uint64_t Index = Sec->getIndex();

// Record this address in a local vector
Functions.push_back((void*)Addr);

// Build the function loaded notification message
iJIT_Method_Load FunctionMessage =
FunctionDescToIntelJITFormat(*Wrapper, Name->data(), Addr, Size);
// TODO: it is neccessary to set proper SectionIndex here.
// object::SectionedAddress::UndefSection works for only absolute addresses.
DILineInfoTable Lines = Context->getLineInfoForAddressRange({Addr, object::SectionedAddress::UndefSection}, Size);
DILineInfoTable Lines =
Context->getLineInfoForAddressRange({Addr, Index}, Size);
DILineInfoTable::iterator Begin = Lines.begin();
DILineInfoTable::iterator End = Lines.end();
for (DILineInfoTable::iterator It = Begin; It != End; ++It) {
Expand Down
24 changes: 12 additions & 12 deletions lib/ObjectYAML/MinidumpYAML.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ class BlobAllocator {
public:
size_t tell() const { return NextOffset; }

size_t AllocateCallback(size_t Size,
size_t allocateCallback(size_t Size,
std::function<void(raw_ostream &)> Callback) {
size_t Offset = NextOffset;
NextOffset += Size;
Callbacks.push_back(std::move(Callback));
return Offset;
}

size_t AllocateBytes(ArrayRef<uint8_t> Data) {
return AllocateCallback(
size_t allocateBytes(ArrayRef<uint8_t> Data) {
return allocateCallback(
Data.size(), [Data](raw_ostream &OS) { OS << toStringRef(Data); });
}

template <typename T> size_t AllocateArray(ArrayRef<T> Data) {
return AllocateBytes({reinterpret_cast<const uint8_t *>(Data.data()),
template <typename T> size_t allocateArray(ArrayRef<T> Data) {
return allocateBytes({reinterpret_cast<const uint8_t *>(Data.data()),
sizeof(T) * Data.size()});
}

template <typename T> size_t AllocateObject(const T &Data) {
return AllocateArray(makeArrayRef(Data));
template <typename T> size_t allocateObject(const T &Data) {
return allocateArray(makeArrayRef(Data));
}

void writeTo(raw_ostream &OS) const;
Expand Down Expand Up @@ -340,18 +340,18 @@ static Directory layout(BlobAllocator &File, Stream &S) {
switch (S.Kind) {
case Stream::StreamKind::RawContent: {
RawContentStream &Raw = cast<RawContentStream>(S);
File.AllocateCallback(Raw.Size, [&Raw](raw_ostream &OS) {
File.allocateCallback(Raw.Size, [&Raw](raw_ostream &OS) {
Raw.Content.writeAsBinary(OS);
assert(Raw.Content.binary_size() <= Raw.Size);
OS << std::string(Raw.Size - Raw.Content.binary_size(), '\0');
});
break;
}
case Stream::StreamKind::SystemInfo:
File.AllocateObject(cast<SystemInfoStream>(S).Info);
File.allocateObject(cast<SystemInfoStream>(S).Info);
break;
case Stream::StreamKind::TextContent:
File.AllocateArray(arrayRefFromStringRef(cast<TextContentStream>(S).Text));
File.allocateArray(arrayRefFromStringRef(cast<TextContentStream>(S).Text));
break;
}
Result.Location.DataSize = File.tell() - Result.Location.RVA;
Expand All @@ -360,11 +360,11 @@ static Directory layout(BlobAllocator &File, Stream &S) {

void MinidumpYAML::writeAsBinary(Object &Obj, raw_ostream &OS) {
BlobAllocator File;
File.AllocateObject(Obj.Header);
File.allocateObject(Obj.Header);

std::vector<Directory> StreamDirectory(Obj.Streams.size());
Obj.Header.StreamDirectoryRVA =
File.AllocateArray(makeArrayRef(StreamDirectory));
File.allocateArray(makeArrayRef(StreamDirectory));
Obj.Header.NumberOfStreams = StreamDirectory.size();

for (auto &Stream : enumerate(Obj.Streams))
Expand Down
2 changes: 2 additions & 0 deletions lib/Target/AMDGPU/SIWholeQuadMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ class SIWholeQuadMode : public MachineFunctionPass {

void getAnalysisUsage(AnalysisUsage &AU) const override {
AU.addRequired<LiveIntervals>();
AU.addPreserved<SlotIndexes>();
AU.addPreserved<LiveIntervals>();
AU.setPreservesCFG();
MachineFunctionPass::getAnalysisUsage(AU);
}
Expand Down
19 changes: 10 additions & 9 deletions lib/Target/ARM/ARMLegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,13 @@ ARMLegalizerInfo::ARMLegalizerInfo(const ARMSubtarget &ST) {

// We're keeping these builders around because we'll want to add support for
// floating point to them.
auto &LoadStoreBuilder =
getActionDefinitionsBuilder({G_LOAD, G_STORE})
.legalForTypesWithMemDesc({
{s1, p0, 8, 8},
{s8, p0, 8, 8},
{s16, p0, 16, 8},
{s32, p0, 32, 8},
{p0, p0, 32, 8}});
auto &LoadStoreBuilder = getActionDefinitionsBuilder({G_LOAD, G_STORE})
.legalForTypesWithMemDesc({{s1, p0, 8, 8},
{s8, p0, 8, 8},
{s16, p0, 16, 8},
{s32, p0, 32, 8},
{p0, p0, 32, 8}})
.unsupportedIfMemSizeNotPow2();

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

LoadStoreBuilder.legalFor({{s64, p0}});
LoadStoreBuilder
.legalForTypesWithMemDesc({{s64, p0, 64, 32}})
.maxScalar(0, s32);
PhiBuilder.legalFor({s64});

getActionDefinitionsBuilder(G_FCMP).legalForCartesianProduct({s1},
Expand Down
Loading

0 comments on commit 13e299c

Please sign in to comment.