[PATCH] D70042: [TargetLowering][DAGCombine][MSP430] Shift Amount Threshold in DAGCombine (4)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 10 06:55:53 PST 2019


spatel added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:2607
 
-  // Return the shift amount threshold for profitable transforms into shifts.
-  // Transforms creating shifts above the returned value will be avoided.
-  virtual unsigned getShiftAmountThreshold(EVT VT) const {
-    return VT.getScalarSizeInBits();
+  // Return true if transforms creating shifts should be avoided.
+  // Targets may override this to return true for expensive shift amounts.
----------------
  /// Return true if creating a shift of the type by the given 
  /// amount is not profitable.


================
Comment at: llvm/include/llvm/CodeGen/TargetLowering.h:2609
+  // Targets may override this to return true for expensive shift amounts.
+  virtual bool shouldAvoidTransformToShift(EVT VT, unsigned amount) const {
+    return false;
----------------
formatting: amount -> Amount
http://llvm.org/docs/CodingStandards.html#name-types-functions-variables-and-enumerators-properly


================
Comment at: llvm/lib/Target/MSP430/MSP430ISelLowering.cpp:364
+                                                       unsigned amount) const {
+  return !(amount == 8 || amount == 9 || amount<=2);
 }
----------------
This changes the MSP430 output for shift by 8 or 9? If yes, there should be tests that show this difference.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70042/new/

https://reviews.llvm.org/D70042





More information about the llvm-commits mailing list