[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 02:25:55 PDT 2022
nikic added a reviewer: nikic.
nikic added a comment.
Please remove the typed pointer test case. I'm willing to accept the patch at this time, but not the test case.
================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:814
Builder.SetInsertPoint(LI1);
+ if (!cast<PointerType>(Load1Ptr->getType())->isOpaque()) {
+ // We require an extra bitcast for non-opaque cases
----------------
Checking for opaque pointers is not necessary, the bitcast will just not be emitted in that case.
================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:817
+ unsigned Load1AS =
+ cast<PointerType>(Load1Ptr->getType())->getAddressSpace();
+ Load1Ptr = Builder.CreateBitCast(
----------------
You can sue `getPointerAddressSpace()` here and save the cast.
================
Comment at: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:824
NewLoad = Builder.CreateAlignedLoad(
IntegerType::get(Load1Ptr->getContext(), LOps.LoadSize), Load1Ptr,
LI1->getAlign(), LI1->isVolatile(), "");
----------------
Extract the IntegerType into a variable for reuse. It is used a third time in the isTypeLegal check above.
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