[llvm] r291025 - AMDGPU: Remove unneccessary intermediate vector
Richard Smith via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 4 19:24:11 PST 2017
On 4 January 2017 at 14:54, Matt Arsenault via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: arsenm
> Date: Wed Jan 4 16:54:10 2017
> New Revision: 291025
>
> URL: http://llvm.org/viewvc/llvm-project?rev=291025&view=rev
> Log:
> AMDGPU: Remove unneccessary intermediate vector
>
This is causing buildbot failures:
http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules/builds/2056
(These were masked by other breakage until now.) Reverted in r291067.
> Modified:
> llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
>
> Modified: llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/
> AMDGPU/AsmParser/AMDGPUAsmParser.cpp?rev=291025&r1=291024&r2=291025&
> view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp (original)
> +++ llvm/trunk/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp Wed Jan 4
> 16:54:10 2017
> @@ -822,6 +822,7 @@ public:
> 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;
> @@ -1630,31 +1631,34 @@ unsigned AMDGPUAsmParser::checkTargetMat
> return Match_Success;
> }
>
> +// What asm variants we should check
> +ArrayRef<unsigned> AMDGPUAsmParser::getMatchedVariants() const {
> + if (getForcedEncodingSize() == 32)
> + return {AMDGPUAsmVariants::DEFAULT};
> +
> + if (isForcedVOP3())
> + return {AMDGPUAsmVariants::VOP3};
> +
> + if (isForcedSDWA())
> + return {AMDGPUAsmVariants::SDWA};
> +
> + if (isForcedDPP())
> + return {AMDGPUAsmVariants::DPP};
> +
> + return {AMDGPUAsmVariants::DEFAULT,
> + AMDGPUAsmVariants::VOP3,
> + AMDGPUAsmVariants::SDWA,
> + AMDGPUAsmVariants::DPP};
>
You're returning ArrayRefs referring to local arrays here. Perhaps you
could add static local variables to hold the contents of these arrays
instead?
> +}
> +
> 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 : MatchedVariants) {
> + for (auto Variant : getMatchedVariants()) {
> uint64_t EI;
> auto R = MatchInstructionImpl(Operands, Inst, EI, MatchingInlineAsm,
> Variant);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170104/41845f9e/attachment.html>
More information about the llvm-commits
mailing list