[all-commits] [llvm/llvm-project] bf23b4: [ValueTracking] Take poison-generating metadata in...

Nikita Popov via All-commits all-commits at lists.llvm.org
Fri Jan 20 03:18:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bf23b4031eeabfccd46a25ce68414d45ae761304
      https://github.com/llvm/llvm-project/commit/bf23b4031eeabfccd46a25ce68414d45ae761304
  Author: Nikita Popov <npopov at redhat.com>
  Date:   2023-01-20 (Fri, 20 Jan 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/ValueTracking.h
    M llvm/include/llvm/IR/Instruction.h
    M llvm/include/llvm/IR/Operator.h
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/IR/Instruction.cpp
    M llvm/lib/IR/Operator.cpp
    M llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
    M llvm/test/Transforms/InstCombine/freeze.ll
    M llvm/test/Transforms/InstCombine/ispow2.ll

  Log Message:
  -----------
  [ValueTracking] Take poison-generating metadata into account (PR59888)

In canCreateUndefOrPoison(), take not only poison-generating flags,
but also poison-generating metadata into account. The helpers are
written generically, but I believe the only case that can actually
matter is !range on calls -- !nonnull and !align are only valid on
loads, and those can create undef/poison anyway.

Unfortunately, this negatively impacts logical to bitwise and/or
conversion: For ctpop/ctlz/cttz we always attach !range metadata,
which will now block the transform, because it might introduce
poison. It would be possible to recover this regression by supporting
a ConsiderFlagsAndMetadata=false mode in impliesPoison() and clearing
flags/metadata on visited instructions.

Fixes https://github.com/llvm/llvm-project/issues/59888.

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




More information about the All-commits mailing list