[PATCH] D107330: [GlobalISel] Combine shr(shl x, c1), c2 to G_SBFX/G_UBFX

Dominik Montada via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 3 06:02:19 PDT 2021


gargaroff added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/GlobalISel/CombinerHelper.h:544
 
+  /// Match: shr (shl x, n), k -> sbfx/ubfx x, n, width
+  bool matchBitfieldExtractFromShr(
----------------
foad wrote:
> This comment suggests that "n" is the same value on the LHS and the RHS, which is not true.
Good point. Fixed!


================
Comment at: llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp:4169
+  const int64_t Pos = ShrAmt - ShlAmt;
+  const int64_t Width = UpperBound - Pos;
+
----------------
foad wrote:
> This is just `Size - ShrAmt`!
Good catch, thanks for spotting!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107330



More information about the llvm-commits mailing list