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

Brian Rzycki via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 4 14:07:47 PDT 2019


brzycki marked an inline comment as done.
brzycki 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;
----------------
craig.topper wrote:
> 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.
That's fine by me. I only wrote it this way to make minimal changes. I'll try your suggested change and test for correctness.


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