diff --git a/tools/llvm-ld/Optimize.cpp b/tools/llvm-ld/Optimize.cpp
index b61e8ef..1e391d6 100644
--- a/tools/llvm-ld/Optimize.cpp
+++ b/tools/llvm-ld/Optimize.cpp
@@ -19,12 +19,19 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/System/DynamicLibrary.h"
 #include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetMachine.h"
 #include "llvm/Transforms/IPO.h"
 #include "llvm/Transforms/Scalar.h"
+#include "llvm/Support/PassNameParser.h"
+#include "llvm/Support/PluginLoader.h"
 using namespace llvm;
 
-// Optimization Options
+// Pass Name Options as generated by the PassNameParser
+static cl::list<const PassInfo*, bool, 
+  FilteredPassNameParser<PassInfo::Optimization> >
+  OptimizationList(cl::desc("Optimizations available:"));
 
+// Optimization Enumeration
 enum OptimizationLevels {
   OPT_FAST_COMPILE         = 1,
   OPT_SIMPLE               = 2,
@@ -33,6 +40,7 @@
   OPT_AGGRESSIVE_LINK_TIME = 5
 };
 
+// Optimization Options
 static cl::opt<OptimizationLevels> OptLevel(
   cl::desc("Choose level of optimization to apply:"),
   cl::init(OPT_FAST_COMPILE), cl::values(
@@ -72,10 +80,6 @@
   cl::aliasopt(DisableInternalize),
   cl::desc("Alias for -disable-internalize"));
 
-static cl::list<std::string> LoadableModules("load",
-  cl::value_desc("path"),
-  cl::desc("Load an optimization module and run it"));
-
 // A utility function that adds a pass to the pass manager but will also add
 // a verifier pass after if we're supposed to verify.
 static inline void addPass(PassManager &PM, Pass *P) {
@@ -150,9 +154,8 @@
 
     addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
 
-    // Run a few AA driven optimizations here and now, to cleanup the code.
+    // Run a few AA driven optimizations, to cleanup the code.
     addPass(Passes, createGlobalsModRefPass());      // IP alias analysis
-
     addPass(Passes, createLICMPass());               // Hoist loop invariants
     addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs
     addPass(Passes, createGCSEPass());               // Remove common subexprs
@@ -168,18 +171,27 @@
     addPass(Passes, createGlobalDCEPass());
   }
 
-  std::vector<std::string> plugins = LoadableModules;
-  for (std::vector<std::string>::iterator I = plugins.begin(),
-      E = plugins.end(); I != E; ++I) {
-    sys::DynamicLibrary dll(I->c_str());
-    typedef void (*OptimizeFunc)(PassManager&,int);
-    OptimizeFunc OF = OptimizeFunc(
-        (intptr_t)dll.GetAddressOfSymbol("RunOptimizations"));
-    if (OF == 0) {
-      throw std::string("Optimization Module '") + *I +
-        "' is missing the RunOptimizations symbol";
-    }
-    (*OF)(Passes,OptLevel);
+  // Create a new optimization pass for each one specified on the command line
+  std::auto_ptr<TargetMachine> target;
+  for (unsigned i = 0; i < OptimizationList.size(); ++i) {
+    const PassInfo *Opt = OptimizationList[i];
+    
+    if (Opt->getNormalCtor())
+      Passes.add(Opt->getNormalCtor()());
+    else if (Opt->getTargetCtor()) {
+      assert(target.get() && "Could not allocate target machine!");
+      Passes.add(Opt->getTargetCtor()(*target.get()));
+    } else
+      std::cerr << "llvm-ld: cannot create pass: " << Opt->getPassName() 
+                << "\n";
+  }
+
+  // The user's passes may leave cruft around. Clean up after them them but
+  // only if we haven't got DisableOptimizations set
+  if (!DisableOptimizations) {
+    addPass(Passes, createInstructionCombiningPass());
+    addPass(Passes, createCFGSimplificationPass());
+    addPass(Passes, createGlobalDCEPass());
   }
 
   // Make sure everything is still good.
