[llvm-bugs] [Bug 27478] New: BasicAA/SCEVAA claim PartialAlias when there is no overlap

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 22 08:03:01 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27478

            Bug ID: 27478
           Summary: BasicAA/SCEVAA claim PartialAlias when there is no
                    overlap
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Global Analyses
          Assignee: unassignedbugs at nondot.org
          Reporter: twoh at fb.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

BasicAA/SCEVAA claims PartialAlias when there is no overlap at all. Ideally
they should claim NoAlias, but if they can't it should be MayAlias not
PartialAlias. 

*** Test code

%"type" = type { [10 x i32], i64 }

define void @test(%"type"* %base) {
entry:
  %int =       getelementptr inbounds %"type", %"type"* %base, i64 0, i32 1
  %arr_first = getelementptr inbounds %"type", %"type"* %base, i64 0, i32 0,
i64 0
  %arr_last =  getelementptr inbounds %"type", %"type"* %base, i64 0, i32 0,
i64 9
  %arr_oob =   getelementptr inbounds %"type", %"type"* %base, i64 0, i32 0,
i64 10 ; out-of-bound access
  br label %loop

loop:
  %index = phi i64 [ 0, %entry ], [ %inc, %loop ]

  %arr_index = getelementptr inbounds %"type", %"type"* %base, i64 0, i32 0,
i64 %index

  %inc = add i64 %index, 1
  %cmp = icmp ult i64 %inc, 10
  br i1 %cmp, label %loop, label %exit

exit:
  ret void
}

*** output from "opt < test.ll –basicaa -aa–eval -print-all-alias-modref-info
-disable-output" (same output for -scev-aa as well)

  PartialAlias: %type* %base,     i64* %int
  MustAlias:    %type* %base,     i32* %arr_first
  NoAlias:      i32* %arr_first,  i64* %int
  PartialAlias: %type* %base,     i32* %arr_last
  NoAlias:      i32* %arr_last,   i64* %int
  NoAlias:      i32* %arr_first,  i32* %arr_last
  PartialAlias: %type* %base,     i32* %arr_oob
  MustAlias:    i32* %arr_oob,    i64* %int
  NoAlias:      i32* %arr_first,  i32* %arr_oob
  NoAlias:      i32* %arr_last,   i32* %arr_oob
  PartialAlias: %type* %base,     i32* %arr_index
  PartialAlias: i32* %arr_index,  i64* %int
  PartialAlias: i32* %arr_first,  i32* %arr_index
  PartialAlias: i32* %arr_index,  i32* %arr_last
  PartialAlias: i32* %arr_index,  i32* %arr_oob
===== Alias Analysis Evaluator Report =====
  15 Total Alias Queries Performed
  5 no alias responses (33.3%)
  0 may alias responses (0.0%)
  8 partial alias responses (53.3%)
  2 must alias responses (13.3%)
  Alias Analysis Evaluator Pointer Alias Summary: 33%/0%/53%/13%
  Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160422/b197996f/attachment.html>


More information about the llvm-bugs mailing list