@@ -158,7 +158,8 @@ class DFAJumpThreading {
158158  void 
159159  unfoldSelectInstrs (DominatorTree *DT,
160160                     const  SmallVector<SelectInstToUnfold, 4 > &SelectInsts) {
161-     DomTreeUpdater DTU (DT, DomTreeUpdater::UpdateStrategy::Eager);
161+     //  TODO: Have everything use a single lazy DTU
162+     DomTreeUpdater DTU (DT, DomTreeUpdater::UpdateStrategy::Lazy);
162163    SmallVector<SelectInstToUnfold, 4 > Stack (SelectInsts);
163164
164165    while  (!Stack.empty ()) {
@@ -977,8 +978,6 @@ struct TransformDFA {
977978
978979  // / Transform each threading path to effectively jump thread the DFA.
979980  void  createAllExitPaths () {
980-     DomTreeUpdater DTU (*DT, DomTreeUpdater::UpdateStrategy::Eager);
981- 
982981    //  Move the switch block to the end of the path, since it will be duplicated
983982    BasicBlock *SwitchBlock = SwitchPaths->getSwitchBlock ();
984983    for  (ThreadingPath &TPath : SwitchPaths->getThreadingPaths ()) {
@@ -995,15 +994,18 @@ struct TransformDFA {
995994    SmallPtrSet<BasicBlock *, 16 > BlocksToClean;
996995    BlocksToClean.insert_range (successors (SwitchBlock));
997996
998-     for  (const  ThreadingPath &TPath : SwitchPaths->getThreadingPaths ()) {
999-       createExitPath (NewDefs, TPath, DuplicateMap, BlocksToClean, &DTU);
1000-       NumPaths++;
1001-     }
997+     {
998+       DomTreeUpdater DTU (*DT, DomTreeUpdater::UpdateStrategy::Lazy);
999+       for  (const  ThreadingPath &TPath : SwitchPaths->getThreadingPaths ()) {
1000+         createExitPath (NewDefs, TPath, DuplicateMap, BlocksToClean, &DTU);
1001+         NumPaths++;
1002+       }
10021003
1003-     //  After all paths are cloned, now update the last successor of the cloned
1004-     //  path so it skips over the switch statement
1005-     for  (const  ThreadingPath &TPath : SwitchPaths->getThreadingPaths ())
1006-       updateLastSuccessor (TPath, DuplicateMap, &DTU);
1004+       //  After all paths are cloned, now update the last successor of the cloned
1005+       //  path so it skips over the switch statement
1006+       for  (const  ThreadingPath &TPath : SwitchPaths->getThreadingPaths ())
1007+         updateLastSuccessor (TPath, DuplicateMap, &DTU);
1008+     }
10071009
10081010    //  For each instruction that was cloned and used outside, update its uses
10091011    updateSSA (NewDefs);
0 commit comments