OSDN Git Service

[SimplifyCFG] SwitchToLookupTable(): don't insert a DomTree edge that already exists
authorRoman Lebedev <lebedev.ri@gmail.com>
Mon, 11 Jan 2021 13:01:57 +0000 (16:01 +0300)
committerRoman Lebedev <lebedev.ri@gmail.com>
Mon, 11 Jan 2021 23:09:46 +0000 (02:09 +0300)
SI is the terminator of BB, so the edge we are adding obviously already existed.

Indeed, this change does not have a test coverage change.
This failure has been exposed in an existing test coverage
by a follow-up patch that switches to lazy domtreeupdater mode,
and removes domtree verification from
SimplifyCFGOpt::simplifyOnce()/SimplifyCFGOpt::run(),
IOW it does not appear feasible to add dedicated test coverage here.

llvm/lib/Transforms/Utils/SimplifyCFG.cpp

index 62cab57..747eb52 100644 (file)
@@ -5973,7 +5973,6 @@ static bool SwitchToLookupTable(SwitchInst *SI, IRBuilder<> &Builder,
     RangeCheckBranch =
         Builder.CreateCondBr(Cmp, LookupBB, SI->getDefaultDest());
     Updates.push_back({DominatorTree::Insert, BB, LookupBB});
-    Updates.push_back({DominatorTree::Insert, BB, SI->getDefaultDest()});
   }
 
   // Populate the BB that does the lookups.