Skip to content

LLVM fails to optimize out unnecessary check for greater than or equal to zero in loop #150134

@johnplatts

Description

@johnplatts

Here is a snippet that demonstrates a missed optimization with LLVM: https://alive2.llvm.org/ce/z/WOvYip

LLVM fails to optimize out the unnecessary %j < %num_to_process check at the beginning of the inner loop in @src in the above LLVM IR snippet as the LLVM optimizer fails to detect that %remaining_len is greater than zero as %i is known to be less than %argc in all iterations of the outer loop due to the icmp sgt checks at the beginning of the outer loop.

alive-tv also determined that the transformation of @src to @tgt in the above snippet appears to be correct.

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