Run code placement optimization for targets that want it (arm and x86 for now).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71726 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodePlacementOpt.cpp b/lib/CodeGen/CodePlacementOpt.cpp
index 61a8b12..919ee54 100644
--- a/lib/CodeGen/CodePlacementOpt.cpp
+++ b/lib/CodeGen/CodePlacementOpt.cpp
@@ -104,6 +104,9 @@
 ///       jcc <cond> C, [exit]
 ///
 bool CodePlacementOpt::OptimizeIntraLoopEdges() {
+  if (!TLI->shouldOptimizeCodePlacement())
+    return false;
+
   bool Changed = false;
   for (unsigned i = 0, e = UncondJmpMBBs.size(); i != e; ++i) {
     MachineBasicBlock *MBB = UncondJmpMBBs[i].first;
diff --git a/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
index d7abd32..1bb3959 100644
--- a/lib/CodeGen/SelectionDAG/TargetLowering.cpp
+++ b/lib/CodeGen/SelectionDAG/TargetLowering.cpp
@@ -483,6 +483,7 @@
   memset(TargetDAGCombineArray, 0, array_lengthof(TargetDAGCombineArray));
   maxStoresPerMemset = maxStoresPerMemcpy = maxStoresPerMemmove = 8;
   allowUnalignedMemoryAccesses = false;
+  benefitFromCodePlacementOpt = false;
   UseUnderscoreSetJmp = false;
   UseUnderscoreLongJmp = false;
   SelectIsExpensive = false;