[PATCH] D60284: [JumpThreading] [PR40992] Fix miscompile when folding a successor of an indirectbr

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 14:01:56 PDT 2019


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/JumpThreading.cpp:1666
   if (OnlyDest && OnlyDest != MultipleDestSentinel) {
     if (PredWithKnownDest == (size_t)pred_size(BB)) {
       bool SeenFirstBranchToOnlyDest = false;
----------------
Can we just use PredToDestList.size() here? And switch to BB->hasNPredecessors(PredToDestList.size()). pred_size is linear in the number of predecessors, but hasNPredecessors will only count to N and return false if that's not the end without continuing to the end.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60284/new/

https://reviews.llvm.org/D60284





More information about the llvm-commits mailing list