[PATCH] D37076: [LICM] Allow sinking when foldable in loop

Jun Bum Lim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 13 10:41:28 PDT 2017


junbuml added inline comments.


================
Comment at: include/llvm/Analysis/TargetTransformInfoImpl.h:826
                                            I->value_op_end());
-    if (getUserCost(I, Operands) == TTI::TCC_Free)
+    SmallVector<const User *, 4> Users(I->user_begin(),
+                                       I->user_end());
----------------
hfinkel wrote:
> Can you add an overload of getUserCost that does not take a users array and composes the list and then you don't need to change this?
Before this change, we had the implementation of  getUserCost(User*, ArrayRef<const Value *>) in TargetTransformInfoImpl.h. So, it was okay to call getUserCost(User, Operands) here. 

In this change I moved the implementation of  getUserCost(User*, ArrayRef<const Value *>)  to TargetTransformInfo.h as a helper function. Now, we have implementation of getUserCost(User*, ArrayRef<const Value *>, ArrayRef<const User *>), so I make this change. 
 
Do you think we need to move implementation of getUserCost(User*, ArrayRef<const Value *>)  in TargetTransformInfoImpl.h? Then, we might need to override each of getUserCost() for targets overriding this function (e.g., X86TargetTransformInfo and HexagonTargetTransformInfo). 
  


https://reviews.llvm.org/D37076





More information about the llvm-commits mailing list