[PATCH] D141056: [SVE][CGBuiltins] Remove need for instcombine from ACLE tests.
Paul Walker via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 11 16:25:50 PST 2023
paulwalker-arm marked an inline comment as done.
paulwalker-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);
----------------
david-arm wrote:
> 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);
> }
Thanks Dave. It turns out IRBuilder has such a helper (well almost) function so I've used that instead.
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