changeset 689:06c05906b054

Always run SimplifyCFG to workaround LLVM bug 2613.
author Christian Kamm <kamm incasoftware de>
date Sun, 12 Oct 2008 15:33:14 +0200
parents 9d6d32b969d7
children 8526cf626110
files gen/toobj.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gen/toobj.cpp	Sun Oct 12 15:31:24 2008 +0200
+++ b/gen/toobj.cpp	Sun Oct 12 15:33:14 2008 +0200
@@ -20,6 +20,7 @@
 #include "llvm/Module.h"
 #include "llvm/ModuleProvider.h"
 #include "llvm/PassManager.h"
+#include "llvm/LinkAllPasses.h"
 #include "llvm/System/Program.h"
 #include "llvm/System/Path.h"
 #include "llvm/Support/raw_ostream.h"
@@ -162,6 +163,12 @@
         }
     }
 
+    // always run this pass to eliminate dead code that breaks debug info
+    llvm::PassManager pm;
+    pm.add(new llvm::TargetData(ir.module));
+    pm.add(llvm::createCFGSimplificationPass());
+    pm.run(*ir.module);
+
     // run optimizer
     ldc_optimize_module(ir.module, global.params.optimizeLevel, global.params.llvmInline);