[llvm] r286975 - Revert "[JumpThreading] Prevent non-deterministic use lists"

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 10:47:06 PST 2016


Hi Pablo,

Next time you revert a commit, could you please:
1) Include the SVN revision number of the reverted commit (at least until
we move to github :-) )
2) Explain why you're reverting. This makes the
commit/revert/reapply/revert/reapply dance that sometimes, unfortunately,
happens a lot easier to track.

Thanks,
  Michael

On Tue, Nov 15, 2016 at 7:42 AM, Pablo Barrio via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: pabbar01
> Date: Tue Nov 15 09:42:17 2016
> New Revision: 286975
>
> URL: http://llvm.org/viewvc/llvm-project?rev=286975&view=rev
> Log:
> Revert "[JumpThreading] Prevent non-deterministic use lists"
>
> This reverts commit f2c2f5354070469dac253373c66527ca971ddc66.
>
> Modified:
>     llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/
> JumpThreading.cpp?rev=286975&r1=286974&r2=286975&view=diff
> ============================================================
> ==================
> --- llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/JumpThreading.cpp Tue Nov 15
> 09:42:17 2016
> @@ -2042,18 +2042,19 @@ bool JumpThreadingPass::TryToUnfoldSelec
>        // Look for scalar booleans used in selects as conditions. If there
> are
>        // several selects that use the same boolean, they are candidates
> for jump
>        // threading and therefore we should unfold them.
> -      for (Use& U : I.uses()) {
> -        auto *SI = dyn_cast<SelectInst>(U.getUser());
> -        if (SI && U.getOperandNo() == 0)
> +      for (Value *U : I.users())
> +        if (auto *SI = dyn_cast<SelectInst>(U))
>            Selects.push_back(SI);
> -      }
> -
>        if (Selects.size() <= 1)
>          continue;
>
> +      // Remove duplicates
> +      std::sort(Selects.begin(), Selects.end());
> +      auto NewEnd = std::unique(Selects.begin(), Selects.end());
> +
>        Changed = true;
> -      for (auto SI : Selects)
> -        expandSelect(SI);
> +      for (auto SI = Selects.begin(); SI != NewEnd; ++SI)
> +        expandSelect(*SI);
>      }
>    }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161115/62739997/attachment.html>


More information about the llvm-commits mailing list