[PATCH] D25991: [PPC] Peephole to remove extra fcmp that checks for NaN

Ehsan Amiri via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 11:46:36 PDT 2016


amehsan added inline comments.


================
Comment at: lib/Target/PowerPC/PPCInstrInfo.cpp:1589
+
+  auto *MI = MRI->getUniqueVRegDef(otherReg);
+  if (MI->getOpcode() != PPC::COPY)
----------------
hfinkel wrote:
> nemanjai wrote:
> > I haven't thought about this enough to decipher whether this is possible so I'd rather ask...
> > Are all of these `getUniqueVRegDef` calls guaranteed to succeed? Namely, is it impossible that any of the arguments are physical registers at this point?
> No. We should check the return code. As in the function below we have:
> 
>   MachineInstr *MI = MRI->getUniqueVRegDef(SrcReg);
>   if (!MI) return false;
> 
Right. I even tested this, but then I forgot to check the return value.


https://reviews.llvm.org/D25991





More information about the llvm-commits mailing list