[PATCH] D46193: [LSR] Skip LSR if the cost of input is cheaper than LSR's solution

Rehana Begam via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 17:16:35 PDT 2018


rehana added a comment.

This patch is causing the following lit-test fails:

  Builtins-i386-linux :: divsc3_test.c
  LLVM :: CodeGen/X86/2006-05-11-InstrSched.ll                                                                          
  LLVM :: CodeGen/X86/MergeConsecutiveStores.ll                                                                         
  LLVM :: CodeGen/X86/atom-fixup-lea3.ll                                                                                
  LLVM :: CodeGen/X86/conditional-tailcall.ll                                                                           
  LLVM :: CodeGen/X86/loop-strength-reduce8.ll                                                                          
  LLVM :: CodeGen/X86/lsr-interesting-step.ll                                                                           
  LLVM :: CodeGen/X86/merge_store.ll                                                                                    
  LLVM :: CodeGen/X86/misched-matrix.ll                                                                                 
  LLVM :: CodeGen/X86/multiple-loop-post-inc.ll                                                                         
  LLVM :: CodeGen/X86/ragreedy-hoist-spill.ll                                                                           
  LLVM :: CodeGen/X86/regalloc-reconcile-broken-hints.ll
  LLVM :: DebugInfo/COFF/fpo-shrink-wrap.ll
  LLVM :: Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll                                                         
  LLVM :: Transforms/LoopStrengthReduce/X86/ivchain-X86.ll                                                              
  LLVM :: Transforms/LoopStrengthReduce/X86/lsr-filtering-scaledreg.ll                                                  
  LLVM :: Transforms/LoopStrengthReduce/X86/nested-loop.ll                                                              
  LLVM :: Transforms/LoopStrengthReduce/funclet.ll                                                                      
  LLVM :: Transforms/LoopStrengthReduce/pr27056.ll

One of the reasons for these fails is that the current GetOrCreateLSRUse function is not taking the reference of "S" as a parameter (explained in the inline comment). Though adding "&" reduces the number of fails, followings are still failing:

  Builtins-i386-linux :: divsc3_test.c
  LLVM :: CodeGen/X86/conditional-tailcall.ll
  LLVM :: CodeGen/X86/regalloc-reconcile-broken-hints.ll
  LLVM :: DebugInfo/COFF/fpo-shrink-wrap.ll             
  LLVM :: Transforms/LoopStrengthReduce/2013-01-14-ReuseCast.ll
  LLVM :: Transforms/LoopStrengthReduce/funclet.ll             
  LLVM :: Transforms/LoopStrengthReduce/pr27056.ll             
  libomptarget :: offloading/offloading_success.c              
  libomptarget :: offloading/offloading_success.cpp

There might be some other problems in the cost modelling algorithm which needs further investigation.



================
Comment at: lib/Transforms/Scalar/LoopStrengthReduce.cpp:3326
+LSRUse &LSRInstance::GetOrCreateLSRUse(
+    Instruction *UserInst, Value *IVOp, const SCEV *S, LSRUse::KindType Kind,
+    MemAccessTy &AccessTy, PostIncLoopSet &TmpPostIncLoops, UseMapTy &LsrUseMap,
----------------
The "S" parameter is missing the "&" and it must be added. This function calls getUse() with "S", and getUse modifies the parameter. Without the "&", the modification by getUse will not be seen by the caller of GetOrCreateLSRUse.


https://reviews.llvm.org/D46193





More information about the llvm-commits mailing list