[PATCH] D135249: [AggressiveInstCombine] Fix cases where non-opaque pointers are used
Biplob Mishra via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 5 03:14:19 PDT 2022
bipmis 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();
----------------
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(), "");
```
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