[all-commits] [llvm/llvm-project] 8a156d: [InstCombine] Fully disable select to and/or i1 fo...

Juneyoung Lee via All-commits all-commits at lists.llvm.org
Wed May 5 17:30:15 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8a156d1c2795189389fadbf33702384f522f2506
      https://github.com/llvm/llvm-project/commit/8a156d1c2795189389fadbf33702384f522f2506
  Author: Juneyoung Lee <aqjune at gmail.com>
  Date:   2021-05-06 (Thu, 06 May 2021)

  Changed paths:
    M clang/test/CodeGenOpenCL/amdgpu-nullptr.cl
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/2008-02-28-OrFCmpCrash.ll
    M llvm/test/Transforms/InstCombine/2012-03-10-InstCombine.ll
    M llvm/test/Transforms/InstCombine/and-fcmp.ll
    M llvm/test/Transforms/InstCombine/and-or-icmp-min-max.ll
    M llvm/test/Transforms/InstCombine/and-or-icmp-nullptr.ll
    M llvm/test/Transforms/InstCombine/and-or-icmps.ll
    M llvm/test/Transforms/InstCombine/and.ll
    M llvm/test/Transforms/InstCombine/and2.ll
    M llvm/test/Transforms/InstCombine/assume.ll
    M llvm/test/Transforms/InstCombine/bit-checks.ll
    M llvm/test/Transforms/InstCombine/demorgan.ll
    M llvm/test/Transforms/InstCombine/div-by-0-guard-before-smul_ov-not.ll
    M llvm/test/Transforms/InstCombine/div-by-0-guard-before-smul_ov.ll
    M llvm/test/Transforms/InstCombine/div-by-0-guard-before-umul_ov-not.ll
    M llvm/test/Transforms/InstCombine/div-by-0-guard-before-umul_ov.ll
    M llvm/test/Transforms/InstCombine/dont-distribute-phi.ll
    M llvm/test/Transforms/InstCombine/icmp.ll
    M llvm/test/Transforms/InstCombine/logical-select-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/logical-select.ll
    M llvm/test/Transforms/InstCombine/onehot_merge.ll
    M llvm/test/Transforms/InstCombine/or-fcmp.ll
    M llvm/test/Transforms/InstCombine/or.ll
    M llvm/test/Transforms/InstCombine/prevent-cmp-merge.ll
    M llvm/test/Transforms/InstCombine/range-check.ll
    M llvm/test/Transforms/InstCombine/select-and-or.ll
    M llvm/test/Transforms/InstCombine/select-bitext.ll
    M llvm/test/Transforms/InstCombine/select-cmp-br.ll
    M llvm/test/Transforms/InstCombine/select-safe-bool-transforms.ll
    M llvm/test/Transforms/InstCombine/select-safe-impliedcond-transforms.ll
    M llvm/test/Transforms/InstCombine/select-safe-transforms.ll
    M llvm/test/Transforms/InstCombine/select.ll
    M llvm/test/Transforms/InstCombine/sign-test-and-or.ll
    M llvm/test/Transforms/InstCombine/signed-truncation-check.ll
    M llvm/test/Transforms/InstCombine/umul-sign-check.ll
    M llvm/test/Transforms/InstCombine/usub-overflow-known-by-implied-cond.ll
    M llvm/test/Transforms/InstCombine/widenable-conditions.ll
    M llvm/test/Transforms/InstCombine/zext-or-icmp.ll
    M llvm/test/Transforms/LoopSimplify/merge-exits.ll
    M llvm/test/Transforms/LoopVectorize/X86/x86-interleaved-accesses-masked-group.ll
    M llvm/test/Transforms/LoopVectorize/reduction-inloop-pred.ll
    M llvm/test/Transforms/LoopVectorize/reduction-inloop.ll
    M llvm/test/Transforms/PGOProfile/chr.ll
    M llvm/test/Transforms/PhaseOrdering/X86/vector-reductions.ll
    M llvm/test/Transforms/PhaseOrdering/unsigned-multiply-overflow-check.ll

  Log Message:
  -----------
  [InstCombine] Fully disable select to and/or i1 folding

This is a patch that disables the poison-unsafe select -> and/or i1 folding.

It has been blocking D72396 and also has been the source of a few miscompilations
described in llvm.org/pr49688 .
D99674 conditionally blocked this folding and successfully fixed the latter one.
The former one was still blocked, and this patch addresses it.

Note that a few test functions that has `_logical` suffix are now deoptimized.
These are created by @nikic to check the impact of disabling this optimization
by copying existing original functions and replacing and/or with select.

I can see that most of these are poison-unsafe; they can be revived by introducing
freeze instruction. I left comments at fcmp + select optimizations (or-fcmp.ll, and-fcmp.ll)
because I think they are good targets for freeze fix.

Reviewed By: nikic

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




More information about the All-commits mailing list