diff --git a/lib/Transforms/Scalar/TailDuplication.cpp b/lib/Transforms/Scalar/TailDuplication.cpp index 22d8157fc08..1473caa2ea8 100644 --- a/lib/Transforms/Scalar/TailDuplication.cpp +++ b/lib/Transforms/Scalar/TailDuplication.cpp @@ -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(I) || isa(I)) return false; + // Only count instructions that are not debugger intrinsics. if (!isa(I)) ++Size; }