[PATCH] DAGCombiner: Assume invariant load cannot alias a store

Matt Arsenault Matthew.Arsenault at amd.com
Thu Jun 25 18:03:22 PDT 2015


This seems to uncover another problem with FindBetterChain.

A simple case of merging 4 constants stores looks like this:

A, ch = CopyFromReg ...
B, ch = load A:1, (add A:0, ...) invariant
C = store B:1, K0, B
D = store C:1, K1, (add B, 4)
E = store D:1, K2, (add B, 8)
F = store E:1, K3, (add B, 12)

Now that the store is known to not alias the load, GatherAllAliases decides that the best chain for the store at chain F is the CopyFromReg chain, putting it on the same chain as the load. This seems broken, but I don't think it will cause any actual problems.

The store at chain C correctly remains on the chain from the load of the pointer, and the other two stores are untouched because they give up on the MemSDNode of the other stores.

However, if I only have 2 stores,
A, ch = CopyFromReg ...
B, ch = load A:1, (add A:0, ...) invariant
C = store B:1, K0, B
D = store C:1, K1, (add B, 4)

The 2nd store correctly has its chain moved to be the same as the 1st's, which is the correct chain out of the load of the pointer


http://reviews.llvm.org/D10749

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list