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: Id6a4d78722aaa0ae35c754c22e5a5ae2854610bf
  • Loading branch information
Jenkins committed Oct 3, 2019
2 parents f4b2516 + 24a2914 commit e29fb18
Show file tree
Hide file tree
Showing 239 changed files with 10,713 additions and 4,877 deletions.
1 change: 1 addition & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.

13 changes: 4 additions & 9 deletions docs/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ Frequently Asked Questions (FAQ)
License
=======

Does the University of Illinois Open Source License really qualify as an "open source" license?
-----------------------------------------------------------------------------------------------
Yes, the license is `certified
<http://www.opensource.org/licenses/UoI-NCSA.php>`_ by the Open Source
Initiative (OSI).


Can I modify LLVM source code and redistribute the modified source?
-------------------------------------------------------------------
Yes. The modified source distribution must retain the copyright notice and
follow the three bulleted conditions listed in the `LLVM license
follow the conditions listed in the `LLVM license
<http://llvm.org/svn/llvm-project/llvm/trunk/LICENSE.TXT>`_.


Expand All @@ -41,10 +34,12 @@ the STL.
How portable is the LLVM source code?
-------------------------------------
The LLVM source code should be portable to most modern Unix-like operating
systems. Most of the code is written in standard C++ with operating system
systems. LLVM has also excellent support on Windows systems.
Most of the code is written in standard C++ with operating system
services abstracted to a support library. The tools required to build and
test LLVM have been ported to a plethora of platforms.


What API do I use to store a value to one of the virtual registers in LLVM IR's SSA representation?
---------------------------------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions include/llvm/CodeGen/MIRYamlMapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ struct ScalarEnumerationTraits<TargetStackID::Value> {
static void enumeration(yaml::IO &IO, TargetStackID::Value &ID) {
IO.enumCase(ID, "default", TargetStackID::Default);
IO.enumCase(ID, "sgpr-spill", TargetStackID::SGPRSpill);
IO.enumCase(ID, "sve-vec", TargetStackID::SVEVector);
IO.enumCase(ID, "noalloc", TargetStackID::NoAlloc);
}
};
Expand Down
1 change: 1 addition & 0 deletions include/llvm/CodeGen/TargetFrameLowering.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace TargetStackID {
enum Value {
Default = 0,
SGPRSpill = 1,
SVEVector = 2,
NoAlloc = 255
};
}
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/IR/IRBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -1649,7 +1649,7 @@ class IRBuilder : public IRBuilderBase, public Inserter {
StoreInst *CreateAlignedStore(Value *Val, Value *Ptr, unsigned Align,
bool isVolatile = false) {
StoreInst *SI = CreateStore(Val, Ptr, isVolatile);
SI->setAlignment(Align);
SI->setAlignment(MaybeAlign(Align));
return SI;
}

Expand Down
2 changes: 0 additions & 2 deletions include/llvm/IR/Instructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,6 @@ class StoreInst : public Instruction {
return 0;
}

// FIXME: Remove once migration to Align is over.
void setAlignment(unsigned Align);
void setAlignment(MaybeAlign Align);

/// Returns the ordering constraint of this store instruction.
Expand Down
40 changes: 32 additions & 8 deletions include/llvm/IR/IntrinsicsAMDGPU.td
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,10 @@ class AMDGPURawBufferLoad<LLVMType data_ty = llvm_any_ty> : Intrinsic <
[llvm_v4i32_ty, // rsrc(SGPR)
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrReadMem, ImmArg<3>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<0>;
def int_amdgcn_raw_buffer_load_format : AMDGPURawBufferLoad<llvm_anyfloat_ty>;
Expand All @@ -911,7 +914,10 @@ class AMDGPUStructBufferLoad<LLVMType data_ty = llvm_any_ty> : Intrinsic <
llvm_i32_ty, // vindex(VGPR)
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrReadMem, ImmArg<4>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<0>;
def int_amdgcn_struct_buffer_load_format : AMDGPUStructBufferLoad<llvm_anyfloat_ty>;
Expand All @@ -923,7 +929,10 @@ class AMDGPURawBufferStore<LLVMType data_ty = llvm_any_ty> : Intrinsic <
llvm_v4i32_ty, // rsrc(SGPR)
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrWriteMem, ImmArg<4>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<1>;
def int_amdgcn_raw_buffer_store_format : AMDGPURawBufferStore<llvm_anyfloat_ty>;
Expand All @@ -936,7 +945,10 @@ class AMDGPUStructBufferStore<LLVMType data_ty = llvm_any_ty> : Intrinsic <
llvm_i32_ty, // vindex(VGPR)
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrWriteMem, ImmArg<5>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<1>;
def int_amdgcn_struct_buffer_store_format : AMDGPUStructBufferStore<llvm_anyfloat_ty>;
Expand Down Expand Up @@ -1050,7 +1062,10 @@ def int_amdgcn_raw_tbuffer_load : Intrinsic <
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty, // format(imm; bits 3..0 = dfmt, bits 6..4 = nfmt)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrReadMem, ImmArg<3>, ImmArg<4>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<0>;

Expand All @@ -1061,7 +1076,10 @@ def int_amdgcn_raw_tbuffer_store : Intrinsic <
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty, // format(imm; bits 3..0 = dfmt, bits 6..4 = nfmt)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrWriteMem, ImmArg<4>, ImmArg<5>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<1>;

Expand All @@ -1072,7 +1090,10 @@ def int_amdgcn_struct_tbuffer_load : Intrinsic <
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty, // format(imm; bits 3..0 = dfmt, bits 6..4 = nfmt)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrReadMem, ImmArg<4>, ImmArg<5>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<0>;

Expand All @@ -1084,7 +1105,10 @@ def int_amdgcn_struct_tbuffer_store : Intrinsic <
llvm_i32_ty, // offset(VGPR/imm, included in bounds checking and swizzling)
llvm_i32_ty, // soffset(SGPR/imm, excluded from bounds checking and swizzling)
llvm_i32_ty, // format(imm; bits 3..0 = dfmt, bits 6..4 = nfmt)
llvm_i32_ty], // cachepolicy(imm; bit 0 = glc, bit 1 = slc, bit 2 = dlc on gfx10+)
llvm_i32_ty], // auxiliary data (imm, cachepolicy (bit 0 = glc,
// bit 1 = slc,
// bit 2 = dlc on gfx10+),
// swizzled buffer (bit 3 = swz))
[IntrWriteMem, ImmArg<5>, ImmArg<6>], "", [SDNPMemOperand]>,
AMDGPURsrcIntrinsic<1>;

Expand Down
28 changes: 27 additions & 1 deletion include/llvm/ObjectYAML/ELFYAML.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ struct Section {
StackSizes,
SymtabShndxSection,
Symver,
MipsABIFlags
MipsABIFlags,
Addrsig
};
SectionKind Kind;
StringRef Name;
Expand Down Expand Up @@ -256,6 +257,26 @@ struct VerneedSection : Section {
}
};

struct AddrsigSymbol {
AddrsigSymbol(StringRef N) : Name(N), Index(None) {}
AddrsigSymbol(llvm::yaml::Hex32 Ndx) : Name(None), Index(Ndx) {}
AddrsigSymbol() : Name(None), Index(None) {}

Optional<StringRef> Name;
Optional<llvm::yaml::Hex32> Index;
};

struct AddrsigSection : Section {
Optional<yaml::BinaryRef> Content;
Optional<llvm::yaml::Hex64> Size;
Optional<std::vector<AddrsigSymbol>> Symbols;

AddrsigSection() : Section(SectionKind::Addrsig) {}
static bool classof(const Section *S) {
return S->Kind == SectionKind::Addrsig;
}
};

struct SymverSection : Section {
std::vector<uint16_t> Entries;

Expand Down Expand Up @@ -362,6 +383,7 @@ struct Object {
} // end namespace ELFYAML
} // end namespace llvm

LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::ELFYAML::AddrsigSymbol)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::ELFYAML::StackSizeEntry)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::ELFYAML::DynamicEntry)
LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::ELFYAML::ProgramHeader)
Expand Down Expand Up @@ -518,6 +540,10 @@ template <> struct MappingTraits<ELFYAML::VernauxEntry> {
static void mapping(IO &IO, ELFYAML::VernauxEntry &E);
};

template <> struct MappingTraits<ELFYAML::AddrsigSymbol> {
static void mapping(IO &IO, ELFYAML::AddrsigSymbol &Sym);
};

template <> struct MappingTraits<ELFYAML::Relocation> {
static void mapping(IO &IO, ELFYAML::Relocation &Rel);
};
Expand Down
17 changes: 17 additions & 0 deletions include/llvm/Target/GlobalISel/Combine.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//===- Combine.td - Combine rule definitions ---------------*- tablegen -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Declare GlobalISel combine rules and provide mechanisms to opt-out.
//
//===----------------------------------------------------------------------===//

// Declares a combiner helper class
class GICombinerHelper<string classname> {
// The class name to use in the generated output.
string Classname = classname;
}
1 change: 1 addition & 0 deletions include/llvm/Transforms/Utils/SimplifyLibCalls.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class LibCallSimplifier {
Value *optimizeMemSet(CallInst *CI, IRBuilder<> &B);
Value *optimizeRealloc(CallInst *CI, IRBuilder<> &B);
Value *optimizeWcslen(CallInst *CI, IRBuilder<> &B);
Value *optimizeBCopy(CallInst *CI, IRBuilder<> &B);
// Wrapper for all String/Memory Library Call Optimizations
Value *optimizeStringMemoryLibCall(CallInst *CI, IRBuilder<> &B);

Expand Down
5 changes: 4 additions & 1 deletion lib/Analysis/AssumptionCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,10 @@ void AssumptionCache::unregisterAssumption(CallInst *CI) {
if (AVI != AffectedValues.end())
AffectedValues.erase(AVI);
}
remove_if(AssumeHandles, [CI](WeakTrackingVH &VH) { return CI == VH; });

AssumeHandles.erase(
remove_if(AssumeHandles, [CI](WeakTrackingVH &VH) { return CI == VH; }),
AssumeHandles.end());
}

void AssumptionCache::AffectedValueCallbackVH::deleted() {
Expand Down
77 changes: 40 additions & 37 deletions lib/Analysis/MemorySSAUpdater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,51 +347,54 @@ void MemorySSAUpdater::insertDef(MemoryDef *MD, bool RenameUses) {

// If this is the first def in the block and this insert is in an arbitrary
// place, compute IDF and place phis.
SmallPtrSet<BasicBlock *, 2> DefiningBlocks;

// If this is the last Def in the block, also compute IDF based on MD, since
// this may a new Def added, and we may need additional Phis.
auto Iter = MD->getDefsIterator();
++Iter;
auto IterEnd = MSSA->getBlockDefs(MD->getBlock())->end();
if (Iter == IterEnd) {
SmallPtrSet<BasicBlock *, 2> DefiningBlocks;
if (Iter == IterEnd)
DefiningBlocks.insert(MD->getBlock());
for (const auto &VH : InsertedPHIs)
if (const auto *RealPHI = cast_or_null<MemoryPhi>(VH))
DefiningBlocks.insert(RealPHI->getBlock());
ForwardIDFCalculator IDFs(*MSSA->DT);
SmallVector<BasicBlock *, 32> IDFBlocks;
IDFs.setDefiningBlocks(DefiningBlocks);
IDFs.calculate(IDFBlocks);
SmallVector<AssertingVH<MemoryPhi>, 4> NewInsertedPHIs;
for (auto *BBIDF : IDFBlocks) {
auto *MPhi = MSSA->getMemoryAccess(BBIDF);
if (!MPhi) {
MPhi = MSSA->createMemoryPhi(BBIDF);
NewInsertedPHIs.push_back(MPhi);
}
// Add the phis created into the IDF blocks to NonOptPhis, so they are
// not optimized out as trivial by the call to getPreviousDefFromEnd
// below. Once they are complete, all these Phis are added to the
// FixupList, and removed from NonOptPhis inside fixupDefs(). Existing
// Phis in IDF may need fixing as well, and potentially be trivial
// before this insertion, hence add all IDF Phis. See PR43044.
NonOptPhis.insert(MPhi);

for (const auto &VH : InsertedPHIs)
if (const auto *RealPHI = cast_or_null<MemoryPhi>(VH))
DefiningBlocks.insert(RealPHI->getBlock());
ForwardIDFCalculator IDFs(*MSSA->DT);
SmallVector<BasicBlock *, 32> IDFBlocks;
IDFs.setDefiningBlocks(DefiningBlocks);
IDFs.calculate(IDFBlocks);
SmallVector<AssertingVH<MemoryPhi>, 4> NewInsertedPHIs;
for (auto *BBIDF : IDFBlocks) {
auto *MPhi = MSSA->getMemoryAccess(BBIDF);
if (!MPhi) {
MPhi = MSSA->createMemoryPhi(BBIDF);
NewInsertedPHIs.push_back(MPhi);
}
for (auto &MPhi : NewInsertedPHIs) {
auto *BBIDF = MPhi->getBlock();
for (auto *Pred : predecessors(BBIDF)) {
DenseMap<BasicBlock *, TrackingVH<MemoryAccess>> CachedPreviousDef;
MPhi->addIncoming(getPreviousDefFromEnd(Pred, CachedPreviousDef),
Pred);
}
// Add the phis created into the IDF blocks to NonOptPhis, so they are not
// optimized out as trivial by the call to getPreviousDefFromEnd below.
// Once they are complete, all these Phis are added to the FixupList, and
// removed from NonOptPhis inside fixupDefs(). Existing Phis in IDF may
// need fixing as well, and potentially be trivial before this insertion,
// hence add all IDF Phis. See PR43044.
NonOptPhis.insert(MPhi);
}
for (auto &MPhi : NewInsertedPHIs) {
auto *BBIDF = MPhi->getBlock();
for (auto *Pred : predecessors(BBIDF)) {
DenseMap<BasicBlock *, TrackingVH<MemoryAccess>> CachedPreviousDef;
MPhi->addIncoming(getPreviousDefFromEnd(Pred, CachedPreviousDef), Pred);
}
}

// Re-take the index where we're adding the new phis, because the above
// call to getPreviousDefFromEnd, may have inserted into InsertedPHIs.
NewPhiIndex = InsertedPHIs.size();
for (auto &MPhi : NewInsertedPHIs) {
InsertedPHIs.push_back(&*MPhi);
FixupList.push_back(&*MPhi);
}
// Re-take the index where we're adding the new phis, because the above call
// to getPreviousDefFromEnd, may have inserted into InsertedPHIs.
NewPhiIndex = InsertedPHIs.size();
for (auto &MPhi : NewInsertedPHIs) {
InsertedPHIs.push_back(&*MPhi);
FixupList.push_back(&*MPhi);
}

FixupList.push_back(MD);
}

Expand Down
10 changes: 3 additions & 7 deletions lib/CodeGen/AsmPrinter/DebugLocStream.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@ class DebugLocStream {
: CU(CU), EntryOffset(EntryOffset) {}
};
struct Entry {
const MCSymbol *BeginSym;
const MCSymbol *EndSym;
const MCSymbol *Begin;
const MCSymbol *End;
size_t ByteOffset;
size_t CommentOffset;
Entry(const MCSymbol *BeginSym, const MCSymbol *EndSym, size_t ByteOffset,
size_t CommentOffset)
: BeginSym(BeginSym), EndSym(EndSym), ByteOffset(ByteOffset),
CommentOffset(CommentOffset) {}
};

private:
Expand Down Expand Up @@ -93,7 +89,7 @@ class DebugLocStream {
/// Until the next call, bytes added to the stream will be added to this
/// entry.
void startEntry(const MCSymbol *BeginSym, const MCSymbol *EndSym) {
Entries.emplace_back(BeginSym, EndSym, DWARFBytes.size(), Comments.size());
Entries.push_back({BeginSym, EndSym, DWARFBytes.size(), Comments.size()});
}

/// Finalize a .debug_loc entry, deleting if it's empty.
Expand Down
Loading

0 comments on commit e29fb18

Please sign in to comment.