HomePhabricator

[NFC][InstSimplify] Some tests for dropping null check after uadd.with.overflow…

Authored by lebedev.ri on Sep 8 2019, 10:50 AM.

Description

[NFC][InstSimplify] Some tests for dropping null check after uadd.with.overflow of non-null (PR43246)

https://rise4fun.com/Alive/WRzq

Name: C <= Y && Y != 0 --> C <= Y iff C != 0
Pre: C != 0

%y_is_nonnull = icmp ne i64 %y, 0
%no_overflow = icmp ule i64 C, %y
%r = and i1 %y_is_nonnull, %no_overflow

>

%r = %no_overflow

Name: C <= Y || Y != 0 --> Y != 0 iff C != 0
Pre: C != 0

%y_is_nonnull = icmp ne i64 %y, 0
%no_overflow = icmp ule i64 C, %y
%r = or i1 %y_is_nonnull, %no_overflow

>

%r = %y_is_nonnull

Name: C > Y || Y == 0 --> C > Y iff C != 0
Pre: C != 0

%y_is_null = icmp eq i64 %y, 0
%overflow = icmp ugt i64 C, %y
%r = or i1 %y_is_null, %overflow

>

%r = %overflow

Name: C > Y && Y == 0 --> Y == 0 iff C != 0
Pre: C != 0

%y_is_null = icmp eq i64 %y, 0
%overflow = icmp ugt i64 C, %y
%r = and i1 %y_is_null, %overflow

>

%r = %y_is_null

https://bugs.llvm.org/show_bug.cgi?id=43246

llvm-svn: 371339

Details

Committed
lebedev.riSep 8 2019, 10:50 AM
Parents
rGdef6ca8b330f: Enable LSan tests for NetBSD/i386
Branches
Unknown
Tags
Unknown