CreateVirtualRegisters does trivial copy coalescing. If a node def is used by a single CopyToReg, it reuses the virtual register assigned to the CopyToReg. This won't work for SDNode that is a clone or is itself cloned. Disable this optimization for those nodes or it can end up with non-SSA machine instructions.

llvm-svn: 62356
diff --git a/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h b/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h
index 7d62b35..52cf4eb 100644
--- a/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h
+++ b/llvm/include/llvm/CodeGen/ScheduleDAGSDNodes.h
@@ -107,7 +107,7 @@
     /// VRBaseMap contains, for each already emitted node, the first virtual
     /// register number for the results of the node.
     ///
-    void EmitNode(SDNode *Node, bool IsClone,
+    void EmitNode(SDNode *Node, bool IsClone, bool HasClone,
                   DenseMap<SDValue, unsigned> &VRBaseMap);
     
     virtual MachineBasicBlock *EmitSchedule();
@@ -144,11 +144,12 @@
     /// EmitCopyFromReg - Generate machine code for an CopyFromReg node or an
     /// implicit physical register output.
     void EmitCopyFromReg(SDNode *Node, unsigned ResNo, bool IsClone,
-                         unsigned SrcReg,
+                         bool IsCloned, unsigned SrcReg,
                          DenseMap<SDValue, unsigned> &VRBaseMap);
     
     void CreateVirtualRegisters(SDNode *Node, MachineInstr *MI,
                                 const TargetInstrDesc &II, bool IsClone,
+                                bool IsCloned,
                                 DenseMap<SDValue, unsigned> &VRBaseMap);
 
     /// BuildSchedUnits, AddSchedEdges - Helper functions for BuildSchedGraph.