[PATCH] [Peephole] Advanced rewriting of copies to avoid cross register banks copies.

hfinkel at anl.gov hfinkel at anl.gov
Mon Jun 30 10:11:10 PDT 2014


================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:148
@@ +147,3 @@
+  /// Given a definition (instruction and definition index), this class
+  /// follow the use-def chain to find successive suitable sources.
+  /// The given source can be used to rewrite the definition into
----------------
follow -> follows

================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:561
@@ -458,3 +560,3 @@
 
     if (TargetRegisterInfo::isPhysicalRegister(Src))
       break;
----------------
What does not work for physical registers?

================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:784
@@ +783,3 @@
+  if (Def->getDesc().getNumOperands() != 2)
+    return false;
+  if (Def->getOperand(DefIdx).getSubReg() != DefSubReg)
----------------
Should this be an assert?

================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:798
@@ +797,3 @@
+  assert(Def->isBitcast() && "Invalid definition");
+
+  // Bitcasts with more than one def are not supported.
----------------
Should we also bail is hasUnmodeledSideEffects?

================
Comment at: lib/CodeGen/PeepholeOptimizer.cpp:981
@@ +980,3 @@
+    return getNextSourceFromInsertSubreg(SrcIdx, SrcSubReg);
+  if (Def->getOpcode() == TargetOpcode::EXTRACT_SUBREG)
+    return getNextSourceFromExtractSubreg(SrcIdx, SrcSubReg);
----------------
I think you might as well add isExtractSubreg().

http://reviews.llvm.org/D4086






More information about the llvm-commits mailing list