[all-commits] [llvm/llvm-project] 2b7c38: [IR][InstSimplify] Clarify poison elements in cttz...

Luke Lau via All-commits all-commits at lists.llvm.org
Wed Sep 16 00:33:39 PDT 2026


  Branch: refs/heads/users/lukel97/lang-ref-poison-elts-reductions-cttz-elts
  Home:   https://github.com/llvm/llvm-project
  Commit: 2b7c382b338bf1be2e5731d8aa14060d5803ca72
      https://github.com/llvm/llvm-project/commit/2b7c382b338bf1be2e5731d8aa14060d5803ca72
  Author: Luke Lau <luke at igalia.com>
  Date:   2026-09-16 (Wed, 16 Sep 2026)

  Changed paths:
    M llvm/docs/LangRef.md
    M llvm/lib/Analysis/ConstantFolding.cpp
    M llvm/test/Transforms/InstSimplify/ConstProp/cttz-elts.ll

  Log Message:
  -----------
  [IR][InstSimplify] Clarify poison elements in cttz.elts results in poison

The generic expansion for cttz.elts in LegalizeVectorOps is

    (reduce.umax (select input, step_vector, 0))

Because reductions produce poison if any element is poison, this will also produce poison.

ConstantFolding currently has short circuiting behaviour, e.g. `cttz.elts <0, 1, poison, poison> -> 1`, but we should probably make this consistent with reductions and just return poison. This updates LangRef and ConstantFolding to be more explicit about this.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list