Skip to content

LLVM fails to reduce zext(op(zext)) in some cases #141360

Open
@AZero13

Description

@AZero13

In the benchmark, I noticed

%30 = zext i16 %.promoted47 to i32
%31 = mul nuw nsw i32 %30, 20
%32 = zext nneg i32 %31 to i64

%31 is not used at all elsewhere.

It should be

%30 = zext i16 %.promoted47 to i64
%31 = mul nuw nsw i64 %30, 20

https://alive2.llvm.org/ce/z/XpJe59

I noticed that LLVM did in fact do this properly when I did an unrelated change: #140178

But that is because the DAG was different, meaning there is an edge case where this is not happening when it should be.

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions