[InstCombine] Fix select + cast fold with constant expression (PR64669)
authorNikita Popov <npopov@redhat.com>
Mon, 14 Aug 2023 15:39:48 +0000 (17:39 +0200)
committerTobias Hieta <tobias@hieta.se>
Tue, 22 Aug 2023 07:02:28 +0000 (09:02 +0200)
commit60a88d4bab72b7c7c5634d58e0b6c08c398991de
tree0c81afd0885b264534e81927341a9fd906a63003
parent1991da9a837dcb083a2a960fbd6a3389da8cc6c1
[InstCombine] Fix select + cast fold with constant expression (PR64669)

The zext constant expression was detected by the fold, but then
handled as a sext. Use ZExtOperator instead of ZExtInst to handle
constant expressions.

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

(cherry picked from commit c15ccfb24afa67d3c3f54e52cc1d1afa564715ed)
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll