[LLVMdev] Memory Dependence Analysis

Eli Friedman eli.friedman at gmail.com
Tue Dec 13 19:26:21 PST 2011


On Tue, Dec 13, 2011 at 3:18 PM, Preston Briggs
<preston.briggs at gmail.com> wrote:
> It doesn't really seem to behave as I had hoped. It's ok, I can write my
> own, but I wondered if perhaps I'm not invoking it properly. Consider this
> simpler example
>
> double test2(int n, double *restrict A, double *restrict B) {
>   A[0] = B[0];
>   for (int i = 0; i < n; i++)
>     A[i] = B[i] + A[i - 1];
>   return A[n - 1];
> }
>
>
> I invoke opt like this:
>
> opt -load ../../../../Debug/lib/preston.dylib -basicaa -mem2reg -simplifycfg
> -loop-simplify -loop-rotate -simplifycfg --preston --debug-pass=Structure <
> test.bc  > /dev/null

Try adding -instcombine.  Some of the code in MemoryDependenceAnalysis
(specifically, PHITransAddr) assumes that instcombine has already run.

-Eli




More information about the llvm-dev mailing list