[PATCH] D67332: [InstSimplify] simplifyUnsignedRangeCheck(): if we know that X != 0, handle more cases (PR43246)
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 8 13:10:53 PDT 2019
lebedev.ri added a comment.
In D67332#1662491 <https://reviews.llvm.org/D67332#1662491>, @lebedev.ri wrote:
> In D67332#1662486 <https://reviews.llvm.org/D67332#1662486>, @spatel wrote:
>
> > Sorry - I just looked over the comments in:
> > https://bugs.llvm.org/show_bug.cgi?id=43246
> >
> > Does this allow removing a more specific (offset is constant) blob of code from instcombine?
>
>
> Can you please point me to it?
> I suspect we get it via multiple folds that happen because
> those instructions have no extra uses and constant on RHS.
declare void @use64(i64)
declare void @use1(i1)
define i1 @test(i64 %offset) {
%1 = add i64 %offset, 100
call void @use64(i64 %1)
%2 = icmp ne i64 %1, 0
%3 = icmp ugt i64 %1, 99
%r = and i1 %2, %3
ret i1 %r
}
gets folded by
// X < Y && Y != 0 --> X < Y
// X < Y || Y != 0 --> Y != 0
if (UnsignedPred == ICmpInst::ICMP_ULT && EqPred == ICmpInst::ICMP_NE)
return IsAnd ? UnsignedICmp : ZeroICmp;
in `simplifyUnsignedRangeCheck()` i don't know if there is anything to delete.
Proceeding to lading the patch.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67332/new/
https://reviews.llvm.org/D67332
More information about the llvm-commits
mailing list