[PATCH] D105953: [MachineVerifier] Diagnose invalid INSERT_SUBREGs
Jon Roelofs via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 21 08:47:51 PDT 2021
jroelofs added inline comments.
================
Comment at: llvm/lib/CodeGen/MachineVerifier.cpp:1787
+ unsigned InsertedSize =
+ TRI->getRegSizeInBits(MI->getOperand(2).getReg(), *MRI);
+ unsigned SubRegSize = TRI->getSubRegIdxSize(MI->getOperand(3).getImm());
----------------
uabelho wrote:
> uabelho wrote:
> > Don't you need to take operand 2's subreg into account here?
> >
> > I'm seeing failures for cases where
> > ```
> > MI->getOperand(2).getReg()
> > ```
> > is indeed too big, but
> > ```
> > MI->getOperand(2).getSubReg()
> > ```
> > is specifying a subreg of a small enough size so there is no problem.
> This seems to work better for me:
> ```
> unsigned InsertedSize;
> if (unsigned SubIdx = MI->getOperand(2).getSubReg())
> InsertedSize = TRI->getSubRegIdxSize(SubIdx);
> else
> InsertedSize =
> TRI->getRegSizeInBits(MI->getOperand(2).getReg(), *MRI);
> ```
Good call, thanks!
4de74a7c4da3516d0d9119452cc073b061716b5d
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105953/new/
https://reviews.llvm.org/D105953
More information about the llvm-commits
mailing list