[LLVMdev] optimizing access to global

Duncan Sands baldrick at free.fr
Wed May 18 11:30:03 PDT 2011


Hi Jochen,

> I'd like to optimize access to a global (write after read), but I didn't get
> it to work. I used:
>
> passManager.add(llvm::createGlobalsModRefPass());

this one isn't needed.  You definitely need to run at least mem2reg or
scalarrepl though: almost all LLVM optimization passes will do nothing
or very little if stuff hasn't first been converted from using memory to
using SSA registers.

Ciao, Duncan.

> passManager.add(llvm::createGVNPass());
>
> Are these passes correct to do it?
>
> And my global is
> @global = internal global %0, align 16
>
> I have for example
> int a = global.a.b[0];
> global.a.b[0] = a; // this should be removed
>
> Does anybody have a hint? It's still llvm 2.8
> Maybe the array access is the cause but all indexes are constant.
>
> -Jochen
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list