[PATCH] D135249: [AggressiveInstCombine] Fix cases where non-opaque pointers are used
David Stuttard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 5 05:32:04 PDT 2022
dstuttard updated this revision to Diff 465351.
dstuttard added a comment.
Include address space AS in the pointerto call
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135249/new/
https://reviews.llvm.org/D135249
Files:
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
Index: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
===================================================================
--- llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
+++ llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -795,9 +795,9 @@
IRBuilder<> Builder(&I);
LoadInst *NewLoad = nullptr, *LI1 = LOps.Root;
+ IntegerType *WiderType = IntegerType::get(I.getContext(), LOps.LoadSize);
// TTI based checks if we want to proceed with wider load
- bool Allowed =
- TTI.isTypeLegal(IntegerType::get(I.getContext(), LOps.LoadSize));
+ bool Allowed = TTI.isTypeLegal(WiderType);
if (!Allowed)
return false;
@@ -811,9 +811,9 @@
// New load can be generated
Value *Load1Ptr = LI1->getPointerOperand();
Builder.SetInsertPoint(LI1);
- NewLoad = Builder.CreateAlignedLoad(
- IntegerType::get(Load1Ptr->getContext(), LOps.LoadSize), Load1Ptr,
- LI1->getAlign(), LI1->isVolatile(), "");
+ Value *NewPtr = Builder.CreateBitCast(Load1Ptr, WiderType->getPointerTo(AS));
+ NewLoad = Builder.CreateAlignedLoad(WiderType, NewPtr, LI1->getAlign(),
+ LI1->isVolatile(), "");
NewLoad->takeName(LI1);
// Set the New Load AATags Metadata.
if (LOps.AATags)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D135249.465351.patch
Type: text/x-patch
Size: 1299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221005/95466574/attachment.bin>
More information about the llvm-commits
mailing list