[all-commits] [llvm/llvm-project] ed2360: [PatternMatch] Do not match constant expressions f...

Nikita Popov via All-commits all-commits at lists.llvm.org
Sat Jul 29 02:22:13 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ed23609bc2adcf3c9b4a446d7a74580adfa76092
      https://github.com/llvm/llvm-project/commit/ed23609bc2adcf3c9b4a446d7a74580adfa76092
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2023-07-29 (Sat, 29 Jul 2023)

  Changed paths:
    M llvm/include/llvm/IR/PatternMatch.h
    M llvm/test/Transforms/InstCombine/mul-inseltpoison.ll
    M llvm/test/Transforms/InstCombine/mul.ll
    M llvm/test/Transforms/InstCombine/pr32686.ll
    M llvm/test/Transforms/InstCombine/switch-constant-expr.ll
    M llvm/test/Transforms/InstCombine/udiv-simplify.ll

  Log Message:
  -----------
  [PatternMatch] Do not match constant expressions for binops

Currently, m_Mul() style matchers also match constant expressions.
This is a regular source of assertion failures (usually by trying
to do a match and then cast to Instruction or BinaryOperator) and
infinite combine loops. At the same time, I don't think this provides
useful optimization capabilities (all of the tests affected here are
regression tests for crashes / infinite loops).

Long term, all of these constant expressions (apart from possibly
add/sub) are slated for removal per
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179
-- but doing those removals can itself expose new crashes and
infinite loops due to the current PatternMatch behavior.

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




More information about the All-commits mailing list