[all-commits] [llvm/llvm-project] 5bb38e: [LoopUnswitch] unswitch if cond is in select form ...

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Sun Mar 7 08:20:18 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5bb38e84d3d0420e7159ffc34e3dd33ab5088b8e
      https://github.com/llvm/llvm-project/commit/5bb38e84d3d0420e7159ffc34e3dd33ab5088b8e
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2021-03-08 (Mon, 08 Mar 2021)

  Changed paths:
    M llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
    M llvm/test/Transforms/SimpleLoopUnswitch/nontrivial-unswitch.ll
    M llvm/test/Transforms/SimpleLoopUnswitch/trivial-unswitch.ll

  Log Message:
  -----------
  [LoopUnswitch] unswitch if cond is in select form of and/or as well

Hello all,
I'm trying to fix unsafe propagation of poison values in and/or conditions by using
equivalent select forms (`select i1 A, i1 B, i1 false` and `select i1 A, i1 true, i1 false`)
instead.
D93065 has links to patches for this.

This patch allows unswitch to happen if the condition is in this form as well.
`collectHomogenousInstGraphLoopInvariants` is updated to keep traversal if
Root and the visiting I matches both m_LogicalOr()/m_LogicalAnd().
Other than this, the remaining changes are almost straightforward and simply replaces
Instruction::And/Or check with match(m_LogicalOr()/m_LogicalAnd()).

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D97756




More information about the All-commits mailing list