[PATCH] D108750: [PowerPC] common chains to reuse offsets to reduce register pressure

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 25 23:06:51 PDT 2021


shchenz created this revision.
shchenz added reviewers: jsji, nemanjai, PowerPC.
Herald added subscribers: kbarton, hiraditya.
shchenz requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

  //    common multiple chains for the load/stores with same offsets in the loop, 
  //    so that we can reuse the offsets and reduce the register pressure in the                                                                         
  //    loop. This transformation can also increase the loop ILP as now each chain
  //    uses its own loop induction add/addi. But this will increase the number of
  //    add/addi in the loop.                                                     
  //
  //    char *p;                                                                  
  //    A1 = p + base1                                                                                                                                   
  //    A2 = p + base1 + offset                                                   
  //    B1 = p + base2                                                            
  //    B2 = p + base2 + offset                                                   
  //                                                                              
  //    for (int i = 0; i < n; i++)                                               
  //      unsigned long x1 = *(unsigned long *)(A1 + i);                          
  //      unsigned long x2 = *(unsigned long *)(A2 + i)                           
  //      unsigned long x3 = *(unsigned long *)(B1 + i);                          
  //      unsigned long x4 = *(unsigned long *)(B2 + i);                          
  //    }                                                                         
  //                                                                              
  //    to look like this:                                                        
  //                                                                                  
  //    A1’ = p + base1 // chain 1                                                    
  //    B1’ = p + base2 // chain 2, now inside the loop, offset is reused.            
  //                                                                                  
  //    for (long long i = 0; i < n; i+=count) {                                      
  //      unsigned long x1 = *(unsigned long *)(A1’ + i);                             
  //      unsigned long x2 = *(unsigned long *)(A1’ + offset + i);                    
  //      unsigned long x3 = *(unsigned long *)(B1’ + i);                             
  //      unsigned long x4 = *(unsigned long *)(B1’ + offset + i);                    
  //    }                                                                             

Found some improvements for our internal benchmarks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108750

Files:
  llvm/lib/Target/PowerPC/PPCLoopInstrFormPrep.cpp
  llvm/test/CodeGen/PowerPC/common-chain.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108750.368811.patch
Type: text/x-patch
Size: 62280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210826/deae8215/attachment-0001.bin>


More information about the llvm-commits mailing list