Skip to content

[InstSimplify] Failure to drop check-for-zero after uadd_with_overflow #42591

@LebedevRI

Description

@LebedevRI
Bugzilla Link 43246
Version trunk
OS Linux
CC @nikic,@rotateright,@vedantk
Fixed by commit(s) 371349

Extended Description

https://rise4fun.com/Alive/yFB

Name: zz
Pre: C != 0
%1 = add i64 C, %offset
%2 = icmp ne i64 %1, 0
%3 = icmp uge i64 %1, C
%r = and i1 %2, %3
=>
%r = icmp uge i64 %1, C

This comes up in https://reviews.llvm.org/D67122

for the code like

char* test(char& base, unsigned long offset) {
return &base + offset;
}

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