PMBuilder: Expose an option to disable tail calls
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 18 Apr 2014 01:05:15 +0000 (01:05 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Fri, 18 Apr 2014 01:05:15 +0000 (01:05 +0000)
Adds API to allow frontends to disable tail calls in PassManagerBuilder.

<rdar://problem/16050591>

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

include/llvm/Transforms/IPO/PassManagerBuilder.h
lib/Transforms/IPO/PassManagerBuilder.cpp

index 42b6b27d0ce0fc7d35d5d4b82af9528b04113e2b..bfd58f11756d71eeba4b5f8656167a3e94023f1e 100644 (file)
@@ -106,6 +106,7 @@ public:
   /// added to the per-module passes.
   Pass *Inliner;
 
+  bool DisableTailCalls;
   bool DisableUnitAtATime;
   bool DisableUnrollLoops;
   bool BBVectorize;
index 76f7c1098b0e24d38d1a054a28decdf9c66166fe..052d24f58aaa563f826a9e4a7e7195d6c2eb50d3 100644 (file)
@@ -58,6 +58,7 @@ PassManagerBuilder::PassManagerBuilder() {
     SizeLevel = 0;
     LibraryInfo = 0;
     Inliner = 0;
+    DisableTailCalls = false;
     DisableUnitAtATime = false;
     DisableUnrollLoops = false;
     BBVectorize = RunBBVectorization;
@@ -183,7 +184,8 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
   MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
   MPM.add(createInstructionCombiningPass());  // Combine silly seq's
 
-  MPM.add(createTailCallEliminationPass());   // Eliminate tail calls
+  if (!DisableTailCalls)
+    MPM.add(createTailCallEliminationPass()); // Eliminate tail calls
   MPM.add(createCFGSimplificationPass());     // Merge & remove BBs
   MPM.add(createReassociatePass());           // Reassociate expressions
   MPM.add(createLoopRotatePass());            // Rotate Loop