@@ -68,6 +68,10 @@ static cl::opt<bool>
6868RunLoopRerolling (" reroll-loops" , cl::Hidden,
6969 cl::desc (" Run the loop rerolling pass" ));
7070
71+ static cl::opt<bool >
72+ SYCLOptimizationMode (" sycl-opt" , cl::init(false ), cl::Hidden,
73+ cl::desc(" Enable SYCL optimization mode." ));
74+
7175static cl::opt<bool > RunNewGVN (" enable-newgvn" , cl::init(false ), cl::Hidden,
7276 cl::desc(" Run the NewGVN pass" ));
7377
@@ -429,7 +433,12 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
429433 MPM.add (createCFGSimplificationPass ());
430434 MPM.add (createInstructionCombiningPass ());
431435 // We resume loop passes creating a second loop pipeline here.
432- MPM.add (createIndVarSimplifyPass ()); // Canonicalize indvars
436+ // TODO: this pass hurts performance due to promotions of induction variables
437+ // from 32-bit value to 64-bit values. I assume it's because SPIR is a virtual
438+ // target with unlimited # of registers and pass doesn't take into account
439+ // that on real HW this promotion is not beneficial.
440+ if (!SYCLOptimizationMode)
441+ MPM.add (createIndVarSimplifyPass ()); // Canonicalize indvars
433442 MPM.add (createLoopIdiomPass ()); // Recognize idioms like memset.
434443 addExtensionsToPM (EP_LateLoopOptimizations, MPM);
435444 MPM.add (createLoopDeletionPass ()); // Delete dead loops
0 commit comments