[PATCH] D63065: [InstSimplify] Fix addo/subo undef folds (PR42209)

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 16 04:14:53 PDT 2019


nikic added a comment.

In D63065#1545052 <https://reviews.llvm.org/D63065#1545052>, @lebedev.ri wrote:

> In D63065#1545036 <https://reviews.llvm.org/D63065#1545036>, @nikic wrote:
>
> > @lebedev.ri Not familiar with what exactly alive proves, but assuming you're using two separate proofs for a reason: It is possible to make the result zero, yes. But only if the overflow flag is chosen as true (rather than false) //at the same time//. Both result & overflow need to be checked together for the result to be meaningful.
>
>
> Good observarvation. Close, but nope:
>
>   $ ./src/alive2/build-Clang-release/alive -root-only /tmp/test.opt 
>   OMP: Info #270: omp_set_nested routine deprecated, please use omp_set_max_active_levels instead.
>   Processing /tmp/test.opt..
>  
>   ----------------------------------------
>   Name: uadd_overflow
>     %X = uadd_overflow i8 %a, undef
>     %Op = extractvalue {i8, i1} %X, 0
>     %Ov = extractvalue {i8, i1} %X, 1
>     %OpIsZero = icmp eq %Op, 0
>     %NoOverflow = icmp eq %Ov, 0
>     %Zero = and i1 %OpIsZero, %NoOverflow
>     ret i1 %Zero
>   =>
>     ret i1 1
>  
>   Done: 1
>   Optimization is correct!
>


Isn't this checking exactly the transform proposed here?


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63065/new/

https://reviews.llvm.org/D63065





More information about the llvm-commits mailing list