[llvm] r305915 - [AMDGPU][MC] Corrected V_*QSAD* instructions to check that dest register is different than any of the src

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 16:05:27 PDT 2017


> On Jun 21, 2017, at 07:41, Dmitry Preobrazhensky via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> +bool isRegIntersect(unsigned Reg0, unsigned Reg1, const MCRegisterInfo* TRI) {
> +
> +  if (Reg0 == Reg1) {
> +    return true;
> +  }
> +
> +  unsigned SubReg0 = TRI->getSubReg(Reg0, 1);
> +  if (SubReg0 == 0) {
> +    return TRI->getSubRegIndex(Reg1, Reg0) > 0;
> +  }
> +
> +  for (unsigned Idx = 2; SubReg0 > 0; ++Idx) {
> +    if (isRegIntersect(Reg1, SubReg0, TRI)) {
> +      return true;
> +    }
> +    SubReg0 = TRI->getSubReg(Reg0, Idx);
> +  }
> +
> +  return false;
> +}
> +


This function isn’t necessary. You should use the MCRegAliasIterator to see if these overlap


More information about the llvm-commits mailing list