================
@@ -2156,9 +2164,13 @@ bool 
SimplifyCFGOpt::hoistSuccIdenticalTerminatorToSwitchOrIf(
       Updates.push_back({DominatorTree::Insert, TIParent, Succ});
   }
 
-  if (DTU)
-    for (BasicBlock *Succ : successors(TI))
+  if (DTU) {
+    // TI might be a switch with multi-cases destination, so we need to care 
for
+    // the duplication of successors.
+    SmallPtrSet<BasicBlock *, 4> UniqSuccs(llvm::from_range, successors(TI));
----------------
nikic wrote:

Ah, I didn't realize that this is a separate function. I do think adding the 
parameter is fine.

Note that you can't use SmallPtrSet here, because order for the updates matters.

https://github.com/llvm/llvm-project/pull/165700
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to