@@ -68,6 +68,10 @@ static cl::opt<bool>
68
68
RunLoopRerolling (" reroll-loops" , cl::Hidden,
69
69
cl::desc (" Run the loop rerolling pass" ));
70
70
71
+ static cl::opt<bool >
72
+ SYCLOptimizationMode (" sycl-opt" , cl::init(false ), cl::Hidden,
73
+ cl::desc(" Enable SYCL optimization mode." ));
74
+
71
75
static cl::opt<bool > RunNewGVN (" enable-newgvn" , cl::init(false ), cl::Hidden,
72
76
cl::desc(" Run the NewGVN pass" ));
73
77
@@ -429,7 +433,12 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
429
433
MPM.add (createCFGSimplificationPass ());
430
434
MPM.add (createInstructionCombiningPass ());
431
435
// 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
433
442
MPM.add (createLoopIdiomPass ()); // Recognize idioms like memset.
434
443
addExtensionsToPM (EP_LateLoopOptimizations, MPM);
435
444
MPM.add (createLoopDeletionPass ()); // Delete dead loops
0 commit comments