[PATCH] D92045: [DSE] Consider out-of-bound writes in isOverwrite.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 16 13:38:07 PST 2020


nikic added a comment.

Thinking about this a bit more, here is one more variation of this problem:

  ; opt -scoped-noalias-aa -dse
  define void @test(i1 %c, i8* %p1, i8* %p2) {
    store i8 0, i8* %p1
    br i1 %c, label %if, label %else
  
  if:
    store i8 1, i8* %p1, !noalias !2
    ret void
  
  else:
    load i8, i8* %p2, !alias.scope !2
    store i8 2, i8* %p1
    ret void
  }
    
  !0 = !{!0}
  !1 = !{!1, !0}
  !2 = !{!1}

Let's say that `%p1 == %p2` if `%c == false`. I believe the noalias metadata is legal in that case, as the branch claiming noalias will not be executed. However, the current DSE logic will decide that `store i8 0` is dead, because the `store i8 1` does not alias with the `load i8` due to the alias metadata attached to them. However, the metadata used to derive that fact is not actually applicable on this branch (using metadata from the `store i8 0` would be legal though, as it is a dominating store).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D92045



More information about the llvm-commits mailing list