[PATCH] D92045: [DSE] Consider out-of-bound writes in isOverwrite.
    Florian Hahn via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Dec 18 07:56:09 PST 2020
    
    
  
fhahn abandoned this revision.
fhahn added a comment.
In D92045#2458839 <https://reviews.llvm.org/D92045#2458839>, @nikic wrote:
> 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).
That's a great motivation to change the order sooner, thanks for putting up  D93523 <https://reviews.llvm.org/D93523>!
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