[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

Reid Spencer reid at x10sys.com
Tue Nov 29 21:21:23 PST 2005



Changes in directory llvm/lib/CodeGen/SelectionDAG:

SelectionDAGISel.cpp updated: 1.106 -> 1.107
---
Log message:

Fix a problem with llvm-ranlib that (on some platforms) caused the archive
file to become corrupted due to interactions between mmap'd memory segments
and file descriptors closing. The problem is completely avoiding by using
a third temporary file.

Patch provided by Evan Jones


---
Diffs of the changes:  (+30 -0)

 SelectionDAGISel.cpp |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+)


Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.106 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.107
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.106	Tue Nov 29 00:21:05 2005
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp	Tue Nov 29 23:21:10 2005
@@ -1161,6 +1161,36 @@
 }
 
 void SelectionDAGLowering::visitMemIntrinsic(CallInst &I, unsigned Op) {
+#if 0
+  // If the size of the cpy/move/set is constant (known)
+  if (ConstantUInt* op3 = dyn_cast<ConstantUInt>(I.getOperand(3))) {
+    uint64_t size = op3->getValue();
+    switch (Op) {
+      case ISD::MEMSET: 
+        if (size <= TLI.getMaxStoresPerMemSet()) {
+          if (ConstantUInt* op4 = dyn_cast<ConstantUInt>(I.getOperand(4))) {
+        uint64_t TySize = TLI.getTargetData().getTypeSize(Ty);
+            uint64_t align = op4.getValue();
+            while (size > align) {
+              size -=align;
+            }
+  Value *SrcV = I.getOperand(0);
+  SDOperand Src = getValue(SrcV);
+  SDOperand Ptr = getValue(I.getOperand(1));
+  DAG.setRoot(DAG.getNode(ISD::STORE, MVT::Other, getRoot(), Src, Ptr,
+                          DAG.getSrcValue(I.getOperand(1))));
+          }
+          break;
+        }
+        break; // don't do this optimization, use a normal memset
+      case ISD::MEMMOVE: 
+      case ISD::MEMCPY:
+        break; // FIXME: not implemented yet
+    }
+  }
+#endif
+
+  // Non-optimized version
   std::vector<SDOperand> Ops;
   Ops.push_back(getRoot());
   Ops.push_back(getValue(I.getOperand(1)));






More information about the llvm-commits mailing list