[PATCH] Hoist load based on alias analysis

Elena Demikhovsky elena.demikhovsky at intel.com
Thu Oct 30 04:05:08 PDT 2014


> The problem is that, on either side of the diamond, you could have address-equivalent but type-inequivalent GEPs. BasicAA can easily show that the resulting offset is the same, but they'll never really be hoisted (I can't say how common this is, and I presume that we don't have a regression test for it, but let's not reduce our capability to handle that situation here).

I checked the following code:

int *iin = (int *)in;
if (trigger[i] > 0) {
    out[i] = in[i] + (float) 0.5;
}
else {
  out[i] /= 3;
  iout[i] += iin[i];
}
And tried to hoist loading in[i]. isSameOperationAs() filters it out because the types are different.

I uploaded the new diff anyway.

http://reviews.llvm.org/D5991

Files:
  lib/Transforms/Scalar/MergedLoadStoreMotion.cpp
  test/Transforms/InstMerge/ld_hoist1.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5991.15566.patch
Type: text/x-patch
Size: 7155 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141030/268e0b95/attachment.bin>


More information about the llvm-commits mailing list