Respect the -tail-dup-size command line option even when optimizing for size.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 30 Jan 2011 20:38:12 +0000 (20:38 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Sun, 30 Jan 2011 20:38:12 +0000 (20:38 +0000)
This is similar to the -unroll-threshold option. There should be no change in
behavior when -tail-dup-size is not explicit on the llc command line.

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

lib/CodeGen/TailDuplication.cpp

index 15aed3436c7771569eede7b3241f75a74ea28d70..83706deb3f7a0a3bb5c1d85ad18ee7858901be28 100644 (file)
@@ -459,7 +459,8 @@ TailDuplicatePass::TailDuplicate(MachineBasicBlock *TailBB, MachineFunction &MF,
   // duplicate only one, because one branch instruction can be eliminated to
   // compensate for the duplication.
   unsigned MaxDuplicateCount;
-  if (MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
+  if (TailDuplicateSize.getNumOccurrences() == 0 &&
+      MF.getFunction()->hasFnAttr(Attribute::OptimizeForSize))
     MaxDuplicateCount = 1;
   else
     MaxDuplicateCount = TailDuplicateSize;