Some questions on the output formats of AliasSetTracker

Dear Staff,
     Here are some questions on the output formats of AliasSetTracker. The code is as below:

int G1 = 9;
int G2 = 5;

int main() {
  int * XX;
  int * YY;

  XX = &G1;
  YY = XX;
  YY = &G2;
  XX = &G2;

}

The output for -anders-aa is:
Alias Set Tracker: 5 alias sets for 4 pointer values.
   AliasSet[0xea6fb0,0] may alias, Mod/Ref
     10 Call Sites: void ({ }*)* @llvm.dbg.func.start, void ({ }*, { }*)* @llvm.dbg.declare, void ({ }*, { }*)* @llvm.dbg.declare, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void ({ }*)* @llvm.dbg.region.end
   AliasSet[0xea7040,1] must alias, Mod/Ref Pointers: (i32** %XX, 8)
   AliasSet[0xea6d40,1] must alias, Mod Pointers: (i32** %YY, 8)
   AliasSet[0xea6ec0,1] must alias, Mod/Ref Pointers: (i32* %0, 4)
   AliasSet[0xea67d0,1] must alias, Mod/Ref Pointers: (i32* %retval, 4)

The output for -steens-aa in poolalloc module is:
Alias Set Tracker: 5 alias sets for 4 pointer values.
   AliasSet[0xeb0e20,0] may alias, Mod/Ref
     10 Call Sites: void ({ }*)* @llvm.dbg.func.start, void ({ }*, { }*)* @llvm.dbg.declare, void ({ }*, { }*)* @llvm.dbg.declare, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void ({ }*)* @llvm.dbg.region.end
   AliasSet[0xeb5a20,1] must alias, Mod/Ref Pointers: (i32** %XX, 8)
   AliasSet[0xebb210,1] must alias, Mod Pointers: (i32** %YY, 8)
   AliasSet[0xebabb0,1] must alias, Mod/Ref Pointers: (i32* %0, 4)
   AliasSet[0xebac10,1] must alias, Mod/Ref Pointers: (i32* %retval, 4)

However, I am a little confused with these output. In Both anders-aa and steens-aa, XX and YY should stay in the same AliasSet, and their alias relationship should be May Alias, right? Sorry I am just a freshman to the alias analysis area, please shed some light on the understanding of the output formats.

Best,
Heming

%XX and %YY are the results of alloca instructions (i.e. equivalent to
the C expressions "&XX" and "&YY"), so they do not in fact alias.

-Eli

Quoting Eli Friedman <eli.friedman@gmail.com>:

Dear Eli,
     Thanks very much for your reply. I have modified the XX and YY to be global variables, but the output of AliasSetTracker are still MUST alias:

Alias Set Tracker: 5 alias sets for 4 pointer values.
   AliasSet[0xea55d0,0] may alias, Mod/Ref
     8 Call Sites: void ({ }*)* @llvm.dbg.func.start, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void (i32, i32, { }*)* @llvm.dbg.stoppoint, void ({ }*)* @llvm.dbg.region.end
   AliasSet[0xeb81e0,1] must alias, Mod/Ref Pointers: (i32** @XX, 8)
   AliasSet[0xea5fc0,1] must alias, Mod Pointers: (i32** @YY, 8)
   AliasSet[0xeab830,1] must alias, Mod/Ref Pointers: (i32* %0, 4)
   AliasSet[0xea5e70,1] must alias, Mod/Ref Pointers: (i32* %retval, 4)

I am sure that the XX and YY are global:
@XX = common global i32* null ; <i32**> [#uses=4]
@YY = common global i32* null ; <i32**> [#uses=3]

would you please tell me more details?

Thanks,
Heming

This means that @XX and the others are each in an alias set of
their own. A "must alias" on an AliasSetTracker AliasSet indicates
that everything in the set is considered to must-alias every other
element in that set. However since the above sets have just one
element each, that indicates that there is no aliasing.

Dan