[PATCH] D128779: [GuardWidening] Add tests showing the incorrect behavior of GW wrt poison

Serguei Katkov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 28 22:41:44 PDT 2022


skatkov added inline comments.


================
Comment at: llvm/test/Transforms/GuardWidening/posion.ll:73
+; CHECK-NEXT:    [[WIDE_CHK:%.*]] = and i1 [[COND_0]], [[COND_2]]
+; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[WIDE_CHK]]) [ "deopt"() ]
+; CHECK-NEXT:    br label [[LOOP:%.*]]
----------------
mkazantsev wrote:
> I don't quite get it. `COND_0` here is not poison, why would logical and not help?
Consider a = 5, b = -1
b.shift and cond2 are poison 
a u< 10
So with logical and the result of select is posion.
guard on poison is UB.

In original program check in the loop b u< 10 protects us from the execution the guard in ok block on poison value - so no UB.


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

https://reviews.llvm.org/D128779



More information about the llvm-commits mailing list