[all-commits] [llvm/llvm-project] 374ef5: [InstCombine] 'hoist xor-by-constant from xor-by-v...

Roman Lebedev via All-commits all-commits at lists.llvm.org
Tue Dec 29 05:28:55 PST 2020


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 374ef57f1379d3d3bbe5bfb19f1d2ea7e79b6db9
      https://github.com/llvm/llvm-project/commit/374ef57f1379d3d3bbe5bfb19f1d2ea7e79b6db9
  Author: Roman Lebedev <lebedev.ri at gmail.com>
  Date:   2020-12-29 (Tue, 29 Dec 2020)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    M llvm/test/Transforms/InstCombine/hoist-xor-by-constant-from-xor-by-value.ll

  Log Message:
  -----------
  [InstCombine] 'hoist xor-by-constant from xor-by-value': completely give up on constant exprs

As Mikael Holmén is noting in the post-commit review for the first fix
https://reviews.llvm.org/rGd4ccef38d0bb#967466
not hoisting constantexprs is not enough,
because if the xor originally was a constantexpr (i.e. X is a constantexpr).
`SimplifyAssociativeOrCommutative()` in `visitXor()` will immediately
undo this transform, thus again causing an infinite combine loop.

This transform has resulted in a surprising number of constantexpr failures.




More information about the All-commits mailing list