[PATCH] D93974: [ValueTracking] Safe assumption context for args

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 13:59:52 PST 2021


jdoerfert added a comment.

In D93974#2494250 <https://reviews.llvm.org/D93974#2494250>, @gilr wrote:

>   define dso_local i32 @_Z1fi(i32 %0) local_unnamed_addr #0 {
>     %2 = and i32 %0, 3
>     %3 = icmp eq i32 %2, 0
>     tail call void @llvm.assume(i1 %3)
>     %4 = or i32 %0, 1
>     ret i32 %4
>   }
>
> Computing the known bits of `%0` with `%2` as the context would have `isValidAssumeForContext()` return false on the assume since `%2` is one of its ephemeral values. Otherwise, simplifying `%2` by computing `%0`'s known bits would be logical bootstrapping - `%0`'s assumed zero bits would be used to simplify `%2` to zero, then `%3` to true and the assume would be lost.

Oh.. this is bad. That happens if you mix two logically differnet things into a single instruction pointer. I put it on the list of things that need to fixed wrt. assumes ... :(

Thanks for the patience. I'm fine with the nullptr solution for now. I need to think more about this "workaround" before I'd suggest an alternative.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93974



More information about the llvm-commits mailing list