aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-11-30 05:21:10 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-11-30 05:21:10 +0000
commit6ff7240a5c484af6e42e2ba6a6d7e03ddf844922 (patch)
tree47282e8fcd8123408d4be798eb39a90d79dc9c8f /lib/CodeGen
parent5b9bbc8792c8b512e6109ff9a98bc89ff0f400ec (diff)
downloadexternal_llvm-6ff7240a5c484af6e42e2ba6a6d7e03ddf844922.zip
external_llvm-6ff7240a5c484af6e42e2ba6a6d7e03ddf844922.tar.gz
external_llvm-6ff7240a5c484af6e42e2ba6a6d7e03ddf844922.tar.bz2
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24527 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 00dc56e..aad1708 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1161,6 +1161,36 @@ void SelectionDAGLowering::visitFrameReturnAddress(CallInst &I, bool isFrame) {
}
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)));