Disable tail duplication of call instructions. The cost
authorChris Lattner <sabre@nondot.org>
Sun, 4 Nov 2007 06:37:55 +0000 (06:37 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 4 Nov 2007 06:37:55 +0000 (06:37 +0000)
metric is way off for these in general, and this works around
buggy code like that in PR1764.  we'll see if there is a big
performance impact of this.  If so, I'll revert it tomorrow.

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

lib/Transforms/Scalar/TailDuplication.cpp

index 22d8157fc085319fc8be9593cc49cd64d662bd30..1473caa2ea8ef710f2f0126524a389d9b39b5271 100644 (file)
@@ -115,6 +115,11 @@ bool TailDup::shouldEliminateUnconditionalBranch(TerminatorInst *TI) {
 
   for (unsigned Size = 0; I != Dest->end(); ++I) {
     if (Size == Threshold) return false;  // The block is too large.
+    
+    // Don't tail duplicate call instructions.  They are very large compared to
+    // other instructions.
+    if (isa<CallInst>(I) || isa<InvokeInst>(I)) return false;
+    
     // Only count instructions that are not debugger intrinsics.
     if (!isa<DbgInfoIntrinsic>(I)) ++Size;
   }