[all-commits] [llvm/llvm-project] cd2fc7: Revert "[ValueTracking][InstCombine] Add a new API...

Florian Hahn via All-commits all-commits at lists.llvm.org
Mon May 29 07:45:13 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd2fc73b49851540b06f91e89a42bdc5affa7e49
  Author: Florian Hahn <flo at fhahn.com>
  Date:   2023-05-29 (Mon, 29 May 2023)

  Changed paths:
    M llvm/include/llvm/Analysis/ValueTracking.h
    M llvm/lib/Analysis/ValueTracking.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/ispow2.ll
    M llvm/test/Transforms/InstCombine/prevent-cmp-merge.ll
    M llvm/test/Transforms/PhaseOrdering/iterator-with-runtime-check.ll

  Log Message:
  Revert "[ValueTracking][InstCombine] Add a new API to allow to ignore poison generating flags or metadatas when implying poison"

This reverts commit 754f3ae65518331b7175d7a9b4a124523ebe6eac.

Unfortunately the change can cause regressions due to dropping flags
from instructions (like nuw,nsw,inbounds), prevent further optimizations
depending on those flags.

A simple example is the IR below, where `inbounds` is dropped with the
patch and the phase-ordering test added in 7c91d82ab912fae8b.

    define i1 @test(ptr %base, i64 noundef %len, ptr %p2) {
      %gep = getelementptr inbounds i32, ptr %base, i64 %len
      %c.1 = icmp uge ptr %p2, %base
      %c.2 = icmp ult ptr %p2, %gep
      %select = select i1 %c.1, i1 %c.2, i1 false
      ret i1 %select

For more discussion, see D149404.

More information about the All-commits mailing list