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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to