Commit a small improvement that is already in the x86 and ia64 backends to
authorNate Begeman <natebegeman@mac.com>
Tue, 14 Jun 2005 03:55:23 +0000 (03:55 +0000)
committerNate Begeman <natebegeman@mac.com>
Tue, 14 Jun 2005 03:55:23 +0000 (03:55 +0000)
not generate unnecessary register copies.  This improves compile time by
2-5% depending on the test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22210 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCISelPattern.cpp

index 750161caf8a0697296f34fc1c146cad27146e96a..5b4c6e58d5cbbf26d9d300594f76a49816c9a549 100644 (file)
@@ -1572,6 +1572,11 @@ unsigned ISel::SelectExpr(SDOperand N, bool Recording) {
   SDNode *Node = N.Val;
   MVT::ValueType DestType = N.getValueType();
 
+  if (Node->getOpcode() == ISD::CopyFromReg &&
+      MRegisterInfo::isVirtualRegister(cast<RegSDNode>(Node)->getReg()))
+    // Just use the specified register as our input.
+    return cast<RegSDNode>(Node)->getReg();
+
   unsigned &Reg = ExprMap[N];
   if (Reg) return Reg;