Mapping instructions between original and modified scop

Skip to first unread message

Ejjeh, Adel

Jul 22, 2022, 4:32:17 PM7/22/22



I am using polly in my own LLVM pass where I modify the schedule of a given scop then directly invoke “polly::CodeGen()” to codegen the updated loop with the new schedule. I have modified the CodeGen() method to where I always only include the new loop instead of conditionally executing it since that fits with the requirements of my pass. I am trying to find a way to map the memory instructions in the original scop to the newly generated one since I need to do some post processing on them after codegen. Is there an existing data structure or mechanism within the Polly environment that can give me that information?




Michael Kruse

Jul 26, 2022, 8:38:15 PM7/26/22
to Ejjeh, Adel,
If I understand correctly, you are looking for the LoadInst or StoreInst for a given MemoryAccess object? MemoryAccess::getAccessInstruction() will return this.

Be aware that there can be multiple MemoryAccesses associated with the same  llvm::Instructions. For instance, when 

%ld = load i8, ptr %ptr

there can be one MemoryAccess for reading from %ptr, and a write MemoryAccess for storing the result in the register %ld (depends on how %ld is used).


You received this message because you are subscribed to the Google Groups "Polly Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web, visit

Tardyzentrismus verboten!
Reply all
Reply to author
0 new messages