[LLVMbugs] [Bug 4748] New: Instcombine transform confuse basicaa

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Aug 20 10:31:17 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=4748

           Summary: Instcombine transform confuse basicaa
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Transformation Utilities
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: evan at fallingsnow.net
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=3343)
 --> (http://llvm.org/bugs/attachment.cgi?id=3343)
File with bad alias info

Attached is an .ll file with 2 functinons which show the problem. @good shows
code as it's commonly emitted by a frontend,  a BC to a GEP. There is an
instcombine transform that converts this to a form like @bad, a GEP to a BC.

The issue is that the GEP to BC form isn't understood by basicaa, so quite a
bit of alias information is lost by this transform. Here is the AA results for
the file:

kendall :: git/rbx ยป llvm-as < bad.ll | opt -aa-eval
-print-all-alias-modref-info -disable-output
Function: bad: 5 pointers, 0 call sites
  MustAlias:    %struct.A* %A, %struct.B* %B
  MayAlias:     %struct.A* %A, %struct.B* %C
  MayAlias:     %struct.B* %B, %struct.B* %C
  MayAlias:     %struct.A* %A, i32* %X
  MayAlias:     %struct.B* %B, i32* %X
  MustAlias:    %struct.B* %C, i32* %X
  MayAlias:     %struct.A* %A, i32* %Y
  NoAlias:      %struct.B* %B, i32* %Y
  MayAlias:     %struct.B* %C, i32* %Y
  MayAlias:     i32* %X, i32* %Y
Function: good: 5 pointers, 0 call sites
  MustAlias:    %struct.A* %A, %struct.B* %B
  MustAlias:    %struct.A* %A, %struct.A* %Q
  MustAlias:    %struct.A* %Q, %struct.B* %B
  MayAlias:     %struct.A* %A, i32* %X
  MayAlias:     %struct.B* %B, i32* %X
  MayAlias:     %struct.A* %Q, i32* %X
  MayAlias:     %struct.A* %A, i32* %Y
  NoAlias:      %struct.B* %B, i32* %Y
  MayAlias:     %struct.A* %Q, i32* %Y
  MustAlias:    i32* %X, i32* %Y
===== Alias Analysis Evaluator Report =====
  20 Total Alias Queries Performed
  2 no alias responses (10.0%)
  12 may alias responses (60.0%)
  6 must alias responses (30.0%)
  Alias Analysis Evaluator Pointer Alias Summary: 10%/60%/30%
  Alias Analysis Mod/Ref Evaluator Summary: no mod/ref!

You can see that critical alias information between %X and %Y is lost in the
transform. I've been advised that the instcombine transform is actually
advantageous in same cases, so I think that basicaa needs to be taught about
this transformed form so it can produce the same aliasing information as the
original form.

In my case, this is an ugly bug, as code that would normally be nicely
optimized is now not, because a number of passes depend on replacing the
redundancy of %X and %Y.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list