[all-commits] [llvm/llvm-project] efba7e: [PatternMatch] Make m_c_ICmp swap the predicate (P...

Nikita Popov via All-commits all-commits at lists.llvm.org
Wed Jan 22 13:56:39 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: efba7ed05e50066deaa19f741c06902a23a9c124
      https://github.com/llvm/llvm-project/commit/efba7ed05e50066deaa19f741c06902a23a9c124
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-01-22 (Wed, 22 Jan 2020)

  Changed paths:
    M llvm/include/llvm/IR/PatternMatch.h
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp

  Log Message:
  -----------
  [PatternMatch] Make m_c_ICmp swap the predicate (PR42801)

This addresses https://bugs.llvm.org/show_bug.cgi?id=42801.
The m_c_ICmp() matcher is changed to provide the swapped predicate
if the operands are swapped.

Existing uses of m_c_ICmp() fall in one of two categories: Working
on equality predicates only, where swapping is irrelevant.
Or performing a manual swap, in which case this patch removes it.

The only exception is the foldICmpWithLowBitMaskedVal() fold, which
does not swap the predicate, and instead reasons about whether
a swap occurred or not for each predicate. Getting the swapped
predicate allows us to merge the logic for pairs of predicates,
instead of duplicating it.

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




More information about the All-commits mailing list