[PATCH] D41187: Ignore metainstructions during the shrink wrap analysis

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 16 10:05:31 PST 2018


MatzeB added inline comments.


================
Comment at: llvm/trunk/lib/CodeGen/ShrinkWrap.cpp:244
+  // Ignore DBG_VALUE and other meta instructions that must not affect codegen.
+  if (MI.isMetaInstruction())
+    return false;
----------------
thegameg wrote:
> MatzeB wrote:
> > thegameg wrote:
> > > Do we also want to ignore
> > > ```
> > > %csr = IMPLICIT_DEF
> > > ```
> > > ?
> > > 
> > > I remember @MatzeB suggested this approach to me to write cleaner tests.
> > Should probably do `MO.isDef() || MO.readsReg()` below instead of this check.
> That would do it for register operands, but seems that `DBG_VALUE` instructions also have `FrameIndex` operands. Is `MI.isDebugValue()` not enough here?
the operands of DBG_VALUE have MachineOperand::isDebug() set, so readsReg() will always return false for them. The good thing about MachineOperand::readsReg() is that it also checks some other conditions that are often forgotten (such as undef operands or internals reads in bundles, which both are forgotten here as well it seems).


Repository:
  rL LLVM

https://reviews.llvm.org/D41187





More information about the llvm-commits mailing list