[llvm] r230147 - R600/SI: Don't crash when getting immediate operand size

David Blaikie dblaikie at gmail.com
Sat Feb 21 14:20:30 PST 2015


Test case?
On Feb 21, 2015 1:32 PM, "Matt Arsenault" <Matthew.Arsenault at amd.com> wrote:

> Author: arsenm
> Date: Sat Feb 21 15:29:04 2015
> New Revision: 230147
>
> URL: http://llvm.org/viewvc/llvm-project?rev=230147&view=rev
> Log:
> R600/SI: Don't crash when getting immediate operand size
>
> Modified:
>     llvm/trunk/lib/Target/R600/SIInstrInfo.h
>
> Modified: llvm/trunk/lib/Target/R600/SIInstrInfo.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/R600/SIInstrInfo.h?rev=230147&r1=230146&r2=230147&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Target/R600/SIInstrInfo.h (original)
> +++ llvm/trunk/lib/Target/R600/SIInstrInfo.h Sat Feb 21 15:29:04 2015
> @@ -254,6 +254,13 @@ public:
>    // instruction opcode.
>    unsigned getOpSize(uint16_t Opcode, unsigned OpNo) const {
>      const MCOperandInfo &OpInfo = get(Opcode).OpInfo[OpNo];
> +
> +    if (OpInfo.RegClass == -1) {
> +      // If this is an immediate operand, this must be a 32-bit literal.
> +      assert(OpInfo.OperandType == MCOI::OPERAND_IMMEDIATE);
> +      return 4;
> +    }
> +
>      return RI.getRegClass(OpInfo.RegClass)->getSize();
>    }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150221/52664b11/attachment.html>


More information about the llvm-commits mailing list