[PATCH] D135249: [AggressiveInstCombine] Fix cases where non-opaque pointers are used
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 5 05:01:49 PDT 2022
nikic added inline comments.
================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:816
+ // We require an extra bitcast for non-opaque cases
+ unsigned Load1AS =
+ cast<PointerType>(Load1Ptr->getType())->getAddressSpace();
----------------
bipmis wrote:
> We already have the Pointer Address space defined for the Load Instruction. So the below should suffice
>
>
> ```
> Type *NewTy = IntegerType::get(Load1Ptr->getContext(), LOps.LoadSize);
> Value *NewPtr = Builder.CreateBitCast(Load1Ptr, NewTy->getPointerTo());
> NewLoad = Builder.CreateAlignedLoad(NewTy, NewPtr, LI1->getAlign(),
> LI1->isVolatile(), "");
> ```
I don't think that's entirely correct, use still need to pass AS to getPointerTo().
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135249/new/
https://reviews.llvm.org/D135249
More information about the llvm-commits
mailing list