[all-commits] [llvm/llvm-project] f1106e: [InstCombine] Remove computeKnownBits() fold for r...

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue May 30 03:17:07 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f1106ef6c9d14d5b516ec352279aeee8f9d12818
      https://github.com/llvm/llvm-project/commit/f1106ef6c9d14d5b516ec352279aeee8f9d12818
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-05-30 (Tue, 30 May 2023)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/assume.ll
    M llvm/test/Transforms/InstCombine/known-phi-br.ll
    M llvm/test/Transforms/InstCombine/zext-or-icmp.ll

  Log Message:
  -----------
  [InstCombine] Remove computeKnownBits() fold for returns

We try to fold constant computeKnownBits() with context for return
instructions only. Otherwise, we rely on SimplifyDemandedBits() to
fold instructions with constant known bits.

The presence of this special fold for returns is dangerous, because
it makes our tests lie about what works and what doesn't. Tests are
usually written by returning the result we're interested in, but
will go through this separate code path that is not used for anything
else. This patch removes the special fold.

This primarily regresses patterns of the style "assume(x); return x".
The responsibility of handling such patterns lies with passes like
EarlyCSE/GVN anyway, which will do this reliably, and not just for
returns.

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




More information about the All-commits mailing list