diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 8adce3115de..de7004d97a0 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/lib/Target/X86/X86TargetMachine.cpp @@ -37,6 +37,10 @@ namespace { cl::opt DisableOutput("disable-x86-llc-output", cl::Hidden, cl::desc("Disable the X86 asm printer, for use " "when profiling the code generator.")); + + cl::opt EnableX86LSR("enable-x86-lsr", cl::Hidden, + cl::desc("Enable the X86 loop strength reduction " + "pass.")); // Register the target. RegisterTarget X("x86", " IA-32 (Pentium and above)"); } @@ -92,6 +96,9 @@ bool X86TargetMachine::addPassesToEmitFile(PassManager &PM, std::ostream &Out, if (FileType != TargetMachine::AssemblyFile && FileType != TargetMachine::ObjectFile) return true; + // Run loop strength reduction before anything else. + if (EnableX86LSR) PM.add(createLoopStrengthReducePass()); + // FIXME: Implement efficient support for garbage collection intrinsics. PM.add(createLowerGCPass());