[PM] Add a SpeculativeExecution pass for targets with divergent branches.

Summary:
This IR pass is helpful for GPUs, and other targets with divergent
branches.  It's a nop on targets without divergent branches.

Reviewers: chandlerc

Subscribers: llvm-commits, jingyue, rnk, joker.eph, tra

Differential Revision: http://reviews.llvm.org/D18626

llvm-svn: 266399
This commit is contained in:
Justin Lebar 2016-04-15 00:32:12 +00:00
parent cad81cf6b3
commit cf63b64fc6
1 changed files with 2 additions and 0 deletions

View File

@ -234,6 +234,8 @@ void PassManagerBuilder::addFunctionSimplificationPasses(
else
MPM.add(createScalarReplAggregatesPass(-1, false));
MPM.add(createEarlyCSEPass()); // Catch trivial redundancies
// Speculative execution if the target has divergent branches; otherwise nop.
MPM.add(createSpeculativeExecutionIfHasBranchDivergencePass());
MPM.add(createJumpThreadingPass()); // Thread jumps.
MPM.add(createCorrelatedValuePropagationPass()); // Propagate conditionals
MPM.add(createCFGSimplificationPass()); // Merge & remove BBs