[LLVMdev] Update load/store alignments

John Criswell criswell at illinois.edu
Fri Dec 13 11:34:41 PST 2013


On 12/13/13 4:00 AM, Mario Schwalbe wrote:
> Hi all,
>
> although I feel like this is a too simple question, I can't find the answer
> right now.
>
> I have a pass that changes the alignment constraints of global variables
> of a module, which doesn't affect any loads and stores of them. So how
> do I get the loads' and stores' alignment constraints also updated to
> match my changes? Is there any pass that does so? Ideally without changing
> too much in the module?

I believe the alignment constraints on loads and stores are for telling 
the code generator that it can assume that the load or store accesses a 
value aligned to that boundary (which on some targets can cause the code 
generator to generate better code).  As such, if you change the 
alignment of a global variable to a larger value, you probably don't 
need to change the alignments of any loads or stores that may access it.

That said, it looks like the LoadInst and StoreInst classes have a 
setAlignment() method that allows you to set the alignment.  Search for 
LoadInst and StoreInst in the LLVM doxygen documentation.

-- John T.

>
> Thanks in advance,
> Mario
> _______________________________________________
> 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