[PATCH] Hoist load based on alias analysis

hfinkel at anl.gov hfinkel at anl.gov
Tue Oct 28 07:09:08 PDT 2014


================
Comment at: lib/Transforms/Scalar/MergedLoadStoreMotion.cpp:265
@@ +264,3 @@
+    BasicBlock *BB0 = Load0->getParent();
+    if (Load0->IsIndenticalToWhenDefefined(Load1) &&
+        !isLoadHoistBarrierInRange(BB1->front(), *Load1, Load1) &&
----------------
delena wrote:
> Gerolf wrote:
> > Typo. Did you mean IsIdenticalToDefined()? Or IsIdendicalLoad()?
> IsIdenticalToDefined is a standard function to compare 2 instructions.
The old code used AA and checked for a MustAlias result. The new code is just checking operand quality, this makes the check less powerful. Please keep the original form of the check *using MustAlias) and use isSameOperationAs as I had suggested.

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).

http://reviews.llvm.org/D5991






More information about the llvm-commits mailing list