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

Matt Arsenault arsenm2 at gmail.com
Sat Feb 21 21:01:10 PST 2015


> On Feb 21, 2015, at 2:20 PM, David Blaikie <dblaikie at gmail.com> wrote:
> 
> Test case?
> 
> 

The following two commits have tests that hit this


> On Feb 21, 2015 1:32 PM, "Matt Arsenault" <Matthew.Arsenault at amd.com <mailto: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 <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 <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 <mailto:llvm-commits at cs.uiuc.edu>
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits <http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits>
> _______________________________________________
> 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/a8c2b395/attachment.html>


More information about the llvm-commits mailing list