Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit fd7dd99

Browse files
authored
Merge pull request #113 from cuviper/merge-release_60
Merge upstream branch `release_60`
2 parents efe8743 + 2de9cac commit fd7dd99

Some content is hidden

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

57 files changed

+2985
-107
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if(NOT DEFINED LLVM_VERSION_MINOR)
2424
set(LLVM_VERSION_MINOR 0)
2525
endif()
2626
if(NOT DEFINED LLVM_VERSION_PATCH)
27-
set(LLVM_VERSION_PATCH 0)
27+
set(LLVM_VERSION_PATCH 1)
2828
endif()
2929
if(NOT DEFINED LLVM_VERSION_SUFFIX)
3030
set(LLVM_VERSION_SUFFIX "")

include/llvm/CodeGen/TargetInstrInfo.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ class TargetInstrInfo : public MCInstrInfo {
421421
/// Build the equivalent inputs of a REG_SEQUENCE for the given \p MI
422422
/// and \p DefIdx.
423423
/// \p [out] InputRegs of the equivalent REG_SEQUENCE. Each element of
424-
/// the list is modeled as <Reg:SubReg, SubIdx>.
424+
/// the list is modeled as <Reg:SubReg, SubIdx>. Operands with the undef
425+
/// flag are not added to this list.
425426
/// E.g., REG_SEQUENCE %1:sub1, sub0, %2, sub1 would produce
426427
/// two elements:
427428
/// - %1:sub1, sub0
@@ -446,7 +447,8 @@ class TargetInstrInfo : public MCInstrInfo {
446447
/// - %1:sub1, sub0
447448
///
448449
/// \returns true if it is possible to build such an input sequence
449-
/// with the pair \p MI, \p DefIdx. False otherwise.
450+
/// with the pair \p MI, \p DefIdx and the operand has no undef flag set.
451+
/// False otherwise.
450452
///
451453
/// \pre MI.isExtractSubreg() or MI.isExtractSubregLike().
452454
///
@@ -465,7 +467,8 @@ class TargetInstrInfo : public MCInstrInfo {
465467
/// - InsertedReg: %1:sub1, sub3
466468
///
467469
/// \returns true if it is possible to build such an input sequence
468-
/// with the pair \p MI, \p DefIdx. False otherwise.
470+
/// with the pair \p MI, \p DefIdx and the operand has no undef flag set.
471+
/// False otherwise.
469472
///
470473
/// \pre MI.isInsertSubreg() or MI.isInsertSubregLike().
471474
///

lib/Analysis/GlobalsModRef.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,8 @@ void GlobalsAAResult::AnalyzeCallGraph(CallGraph &CG, Module &M) {
502502
}
503503

504504
FunctionInfo &FI = FunctionInfos[F];
505+
Handles.emplace_front(*this, F);
506+
Handles.front().I = Handles.begin();
505507
bool KnowNothing = false;
506508

507509
// Collect the mod/ref properties due to called functions. We only compute

lib/Analysis/MemorySSA.cpp

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,14 @@ class MemoryLocOrCall {
153153
if (IsCall != Other.IsCall)
154154
return false;
155155

156-
if (IsCall)
157-
return CS.getCalledValue() == Other.CS.getCalledValue();
158-
return Loc == Other.Loc;
156+
if (!IsCall)
157+
return Loc == Other.Loc;
158+
159+
if (CS.getCalledValue() != Other.CS.getCalledValue())
160+
return false;
161+
162+
return CS.arg_size() == Other.CS.arg_size() &&
163+
std::equal(CS.arg_begin(), CS.arg_end(), Other.CS.arg_begin());
159164
}
160165

161166
private:
@@ -179,12 +184,18 @@ template <> struct DenseMapInfo<MemoryLocOrCall> {
179184
}
180185

181186
static unsigned getHashValue(const MemoryLocOrCall &MLOC) {
182-
if (MLOC.IsCall)
183-
return hash_combine(MLOC.IsCall,
184-
DenseMapInfo<const Value *>::getHashValue(
185-
MLOC.getCS().getCalledValue()));
186-
return hash_combine(
187-
MLOC.IsCall, DenseMapInfo<MemoryLocation>::getHashValue(MLOC.getLoc()));
187+
if (!MLOC.IsCall)
188+
return hash_combine(
189+
MLOC.IsCall,
190+
DenseMapInfo<MemoryLocation>::getHashValue(MLOC.getLoc()));
191+
192+
hash_code hash =
193+
hash_combine(MLOC.IsCall, DenseMapInfo<const Value *>::getHashValue(
194+
MLOC.getCS().getCalledValue()));
195+
196+
for (const Value *Arg : MLOC.getCS().args())
197+
hash = hash_combine(hash, DenseMapInfo<const Value *>::getHashValue(Arg));
198+
return hash;
188199
}
189200

190201
static bool isEqual(const MemoryLocOrCall &LHS, const MemoryLocOrCall &RHS) {

lib/CodeGen/LiveDebugVariables.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,11 @@ bool LDVImpl::handleDebugValue(MachineInstr &MI, SlotIndex Idx) {
557557
getUserValue(Var, Expr, MI.getDebugLoc());
558558
if (!Discard)
559559
UV->addDef(Idx, MI.getOperand(0), IsIndirect);
560-
else
561-
UV->addDef(Idx, MachineOperand::CreateReg(0U, RegState::Debug), false);
560+
else {
561+
MachineOperand MO = MachineOperand::CreateReg(0U, false);
562+
MO.setIsDebug();
563+
UV->addDef(Idx, MO, false);
564+
}
562565
return true;
563566
}
564567

lib/CodeGen/PeepholeOptimizer.cpp

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,8 @@ ValueTrackerResult ValueTracker::getNextSourceFromCopy() {
18821882
return ValueTrackerResult();
18831883
// Otherwise, we want the whole source.
18841884
const MachineOperand &Src = Def->getOperand(1);
1885+
if (Src.isUndef())
1886+
return ValueTrackerResult();
18851887
return ValueTrackerResult(Src.getReg(), Src.getSubReg());
18861888
}
18871889

@@ -1925,6 +1927,8 @@ ValueTrackerResult ValueTracker::getNextSourceFromBitcast() {
19251927
}
19261928

19271929
const MachineOperand &Src = Def->getOperand(SrcIdx);
1930+
if (Src.isUndef())
1931+
return ValueTrackerResult();
19281932
return ValueTrackerResult(Src.getReg(), Src.getSubReg());
19291933
}
19301934

@@ -2093,6 +2097,10 @@ ValueTrackerResult ValueTracker::getNextSourceFromPHI() {
20932097
for (unsigned i = 1, e = Def->getNumOperands(); i < e; i += 2) {
20942098
auto &MO = Def->getOperand(i);
20952099
assert(MO.isReg() && "Invalid PHI instruction");
2100+
// We have no code to deal with undef operands. They shouldn't happen in
2101+
// normal programs anyway.
2102+
if (MO.isUndef())
2103+
return ValueTrackerResult();
20962104
Res.addSource(MO.getReg(), MO.getSubReg());
20972105
}
20982106

@@ -2149,9 +2157,14 @@ ValueTrackerResult ValueTracker::getNextSource() {
21492157
// If we can still move up in the use-def chain, move to the next
21502158
// definition.
21512159
if (!TargetRegisterInfo::isPhysicalRegister(Reg) && OneRegSrc) {
2152-
Def = MRI.getVRegDef(Reg);
2153-
DefIdx = MRI.def_begin(Reg).getOperandNo();
2154-
DefSubReg = Res.getSrcSubReg(0);
2160+
MachineRegisterInfo::def_iterator DI = MRI.def_begin(Reg);
2161+
if (DI != MRI.def_end()) {
2162+
Def = DI->getParent();
2163+
DefIdx = DI.getOperandNo();
2164+
DefSubReg = Res.getSrcSubReg(0);
2165+
} else {
2166+
Def = nullptr;
2167+
}
21552168
return Res;
21562169
}
21572170
}

lib/CodeGen/TargetInstrInfo.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1151,6 +1151,8 @@ bool TargetInstrInfo::getRegSequenceInputs(
11511151
for (unsigned OpIdx = 1, EndOpIdx = MI.getNumOperands(); OpIdx != EndOpIdx;
11521152
OpIdx += 2) {
11531153
const MachineOperand &MOReg = MI.getOperand(OpIdx);
1154+
if (MOReg.isUndef())
1155+
continue;
11541156
const MachineOperand &MOSubIdx = MI.getOperand(OpIdx + 1);
11551157
assert(MOSubIdx.isImm() &&
11561158
"One of the subindex of the reg_sequence is not an immediate");
@@ -1174,6 +1176,8 @@ bool TargetInstrInfo::getExtractSubregInputs(
11741176
// Def = EXTRACT_SUBREG v0.sub1, sub0.
11751177
assert(DefIdx == 0 && "EXTRACT_SUBREG only has one def");
11761178
const MachineOperand &MOReg = MI.getOperand(1);
1179+
if (MOReg.isUndef())
1180+
return false;
11771181
const MachineOperand &MOSubIdx = MI.getOperand(2);
11781182
assert(MOSubIdx.isImm() &&
11791183
"The subindex of the extract_subreg is not an immediate");
@@ -1198,6 +1202,8 @@ bool TargetInstrInfo::getInsertSubregInputs(
11981202
assert(DefIdx == 0 && "INSERT_SUBREG only has one def");
11991203
const MachineOperand &MOBaseReg = MI.getOperand(1);
12001204
const MachineOperand &MOInsertedReg = MI.getOperand(2);
1205+
if (MOInsertedReg.isUndef())
1206+
return false;
12011207
const MachineOperand &MOSubIdx = MI.getOperand(3);
12021208
assert(MOSubIdx.isImm() &&
12031209
"One of the subindex of the reg_sequence is not an immediate");

lib/Support/Host.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ StringRef sys::getHostCPUName() {
10091009
#include "llvm/Support/X86TargetParser.def"
10101010

10111011
// Now check types.
1012-
#define X86_CPU_SUBTYPE(ARCHNAME, ENUM) \
1012+
#define X86_CPU_TYPE(ARCHNAME, ENUM) \
10131013
if (Type == X86::ENUM) \
10141014
return ARCHNAME;
10151015
#include "llvm/Support/X86TargetParser.def"

lib/Target/AArch64/AArch64FalkorHWPFFix.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include "llvm/Pass.h"
4747
#include "llvm/Support/Casting.h"
4848
#include "llvm/Support/Debug.h"
49+
#include "llvm/Support/DebugCounter.h"
4950
#include "llvm/Support/raw_ostream.h"
5051
#include <cassert>
5152
#include <iterator>
@@ -60,6 +61,8 @@ STATISTIC(NumCollisionsAvoided,
6061
"Number of HW prefetch tag collisions avoided");
6162
STATISTIC(NumCollisionsNotAvoided,
6263
"Number of HW prefetch tag collisions not avoided due to lack of regsiters");
64+
DEBUG_COUNTER(FixCounter, "falkor-hwpf",
65+
"Controls which tag collisions are avoided");
6366

6467
namespace {
6568

@@ -729,6 +732,21 @@ void FalkorHWPFFix::runOnLoop(MachineLoop &L, MachineFunction &Fn) {
729732
bool Fixed = false;
730733
DEBUG(dbgs() << "Attempting to fix tag collision: " << MI);
731734

735+
if (!DebugCounter::shouldExecute(FixCounter)) {
736+
DEBUG(dbgs() << "Skipping fix due to debug counter:\n " << MI);
737+
continue;
738+
}
739+
740+
// Add the non-base registers of MI as live so we don't use them as
741+
// scratch registers.
742+
for (unsigned OpI = 0, OpE = MI.getNumOperands(); OpI < OpE; ++OpI) {
743+
if (OpI == static_cast<unsigned>(LdI.BaseRegIdx))
744+
continue;
745+
MachineOperand &MO = MI.getOperand(OpI);
746+
if (MO.isReg() && MO.readsReg())
747+
LR.addReg(MO.getReg());
748+
}
749+
732750
for (unsigned ScratchReg : AArch64::GPR64RegClass) {
733751
if (!LR.available(ScratchReg) || MRI.isReserved(ScratchReg))
734752
continue;

lib/Target/AMDGPU/AMDGPUTargetMachine.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ extern "C" void LLVMInitializeAMDGPUTarget() {
147147
initializeR600PacketizerPass(*PR);
148148
initializeR600ExpandSpecialInstrsPassPass(*PR);
149149
initializeR600VectorRegMergerPass(*PR);
150+
initializeGlobalISel(*PR);
150151
initializeAMDGPUDAGToDAGISelPass(*PR);
151152
initializeSILowerI1CopiesPass(*PR);
152153
initializeSIFixSGPRCopiesPass(*PR);

0 commit comments

Comments
 (0)