[PATCH] D27174: [LiveRangeEdit] Handle instructions with no defs correctly.

Geoff Berry via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 12:08:36 PST 2016


gberry created this revision.
gberry added reviewers: qcolombet, MatzeB, wmi.
gberry added a subscriber: llvm-commits.
Herald added a subscriber: mcrosier.

The code in LiveRangeEdit::eliminateDeadDef() that computes isOrigDef
doesn't handle instructions in which operand 0 is not a def (e.g. KILL)
correctly.  Add a check that operand 0 is a def before doing the rest of
the isOrigDef computation.


https://reviews.llvm.org/D27174

Files:
  lib/CodeGen/LiveRangeEdit.cpp


Index: lib/CodeGen/LiveRangeEdit.cpp
===================================================================
--- lib/CodeGen/LiveRangeEdit.cpp
+++ lib/CodeGen/LiveRangeEdit.cpp
@@ -272,7 +272,7 @@
   bool ReadsPhysRegs = false;
   bool isOrigDef = false;
   unsigned Dest;
-  if (VRM && MI->getOperand(0).isReg()) {
+  if (VRM && MI->getOperand(0).isReg() && MI->getOperand(0).isDef()) {
     Dest = MI->getOperand(0).getReg();
     unsigned Original = VRM->getOriginal(Dest);
     LiveInterval &OrigLI = LIS.getInterval(Original);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27174.79432.patch
Type: text/x-patch
Size: 528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161128/432789ac/attachment.bin>


More information about the llvm-commits mailing list