[all-commits] [llvm/llvm-project] 700feb: [InstCombine] Fix incorrect is_zero_poison when fo...
Justin Lebar via All-commits
all-commits at lists.llvm.org
Mon Jun 8 13:48:25 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 700febc04caa41923eaf4b3911db26cb13482a83
https://github.com/llvm/llvm-project/commit/700febc04caa41923eaf4b3911db26cb13482a83
Author: Justin Lebar <justin.lebar at gmail.com>
Date: 2026-06-08 (Mon, 08 Jun 2026)
Changed paths:
M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
M llvm/test/Transforms/InstCombine/select-ctlz-to-cttz.ll
Log Message:
-----------
[InstCombine] Fix incorrect is_zero_poison when folding select+ctlz to cttz (#202388)
foldSelectCtlzToCttz folds
%lz = call i32 @llvm.ctlz.i32(i32 (x & -x), i1 is_zero_poison)
%r = select (icmp eq x, 0), i32 32, i32 (xor %lz, 31)
into
%r = call i32 @llvm.cttz.i32(i32 x, i1 is_zero_poison)
The original select's result is defined when x is zero, even if
is_zero_poison is true. Therefore in the new cttz call, we need to pass
false for the second param, we can't reuse is_zero_poison.
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