[PATCH] D141056: [SVE][CGBuiltins] Remove need for instcombine from ACLE tests.

David Sherwood via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 11 01:59:55 PST 2023


david-arm added inline comments.


================
Comment at: clang/lib/CodeGen/CGBuiltin.cpp:9092
+      if (BytesPerElt > 1) {
+        Value *Scale = ConstantInt::get(Int64Ty, Log2_32(BytesPerElt));
+        Ops[2] = Builder.CreateShl(Ops[2], Scale);
----------------
Given this seems a frequent idiom is it worth putting this into a helper routine? i.e. something like

  Ops[2] = getScaledOffset(Ops[2], BytesPerElt);

where

  Value *getScaledOffset(SDValue Offset, unsigned Bytes) {
    Value *Scale = ConstantInt::get(Int64Ty, Log2_32(Bytes));
    return Builder.CreateShl(Offset, Scale);
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141056



More information about the cfe-commits mailing list