Skip to content

Commit

Permalink
Revert "Reapply r291025 ("AMDGPU: Remove unneccessary intermediate ve…
Browse files Browse the repository at this point in the history
…ctor")"

Summary: This reverts commit r291144. It breaks build bots.

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-autoconf/builds/3270, http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fuzzer/builds/2058

lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:1638:12: error: could not convert ‘(const unsigned int*)(& Variants)’ from ‘const unsigned int*’ to ‘llvm::ArrayRef<unsigned int>’
     return Variants;

Reviewers: eugenis, tstellarAMD

Patch by Alex Shlyapnikov.

Subscribers: arsenm, kzhuravl, wdng, nhaehnle, yaxunl, tony-tye, llvm-commits

Differential Revision: https://reviews.llvm.org/D28372

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291168 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
eugenis committed Jan 5, 2017
1 parent 38716ac commit 795e15e
Showing 1 changed file with 19 additions and 33 deletions.
52 changes: 19 additions & 33 deletions lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,6 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
bool isForcedVOP3() const { return ForcedEncodingSize == 64; }
bool isForcedDPP() const { return ForcedDPP; }
bool isForcedSDWA() const { return ForcedSDWA; }
ArrayRef<unsigned> getMatchedVariants() const;

std::unique_ptr<AMDGPUOperand> parseRegister();
bool ParseRegister(unsigned &RegNo, SMLoc &StartLoc, SMLoc &EndLoc) override;
Expand Down Expand Up @@ -1631,44 +1630,31 @@ unsigned AMDGPUAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
return Match_Success;
}

// What asm variants we should check
ArrayRef<unsigned> AMDGPUAsmParser::getMatchedVariants() const {
if (getForcedEncodingSize() == 32) {
static const unsigned Variants[] = {AMDGPUAsmVariants::DEFAULT};
return Variants;
}

if (isForcedVOP3()) {
static const unsigned Variants[] = {AMDGPUAsmVariants::VOP3};
return Variants;
}

if (isForcedSDWA()) {
static const unsigned Variants[] = {AMDGPUAsmVariants::SDWA};
return Variants;
}

if (isForcedDPP()) {
static const unsigned Variants[] = {AMDGPUAsmVariants::DPP};
return Variants;
}

static const unsigned Variants[] = {
AMDGPUAsmVariants::DEFAULT, AMDGPUAsmVariants::VOP3,
AMDGPUAsmVariants::SDWA, AMDGPUAsmVariants::DPP
};

return Variants;
}

bool AMDGPUAsmParser::MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
OperandVector &Operands,
MCStreamer &Out,
uint64_t &ErrorInfo,
bool MatchingInlineAsm) {
// What asm variants we should check
std::vector<unsigned> MatchedVariants;
if (getForcedEncodingSize() == 32) {
MatchedVariants = {AMDGPUAsmVariants::DEFAULT};
} else if (isForcedVOP3()) {
MatchedVariants = {AMDGPUAsmVariants::VOP3};
} else if (isForcedSDWA()) {
MatchedVariants = {AMDGPUAsmVariants::SDWA};
} else if (isForcedDPP()) {
MatchedVariants = {AMDGPUAsmVariants::DPP};
} else {
MatchedVariants = {AMDGPUAsmVariants::DEFAULT,
AMDGPUAsmVariants::VOP3,
AMDGPUAsmVariants::SDWA,
AMDGPUAsmVariants::DPP};
}

MCInst Inst;
unsigned Result = Match_Success;
for (auto Variant : getMatchedVariants()) {
for (auto Variant : MatchedVariants) {
uint64_t EI;
auto R = MatchInstructionImpl(Operands, Inst, EI, MatchingInlineAsm,
Variant);
Expand Down Expand Up @@ -3500,7 +3486,7 @@ void AMDGPUAsmParser::cvtSDWA(MCInst &Inst, const OperandVector &Operands,
for (unsigned E = Operands.size(); I != E; ++I) {
AMDGPUOperand &Op = ((AMDGPUOperand &)*Operands[I]);
// Add the register arguments
if ((BasicInstType == SIInstrFlags::VOPC ||
if ((BasicInstType == SIInstrFlags::VOPC ||
BasicInstType == SIInstrFlags::VOP2)&&
Op.isReg() &&
Op.Reg.RegNo == AMDGPU::VCC) {
Expand Down

0 comments on commit 795e15e

Please sign in to comment.