[PATCH] D97667: [loop-idiom] Hoist loop memcpys to loop preheader
Han Zhu via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 30 16:51:10 PDT 2021
zhuhan0 added a comment.
In D97667#2725626 <https://reviews.llvm.org/D97667#2725626>, @dstenb wrote:
> With this patch we got the following assertion:
>
> bool llvm::APInt::operator==(const llvm::APInt &) const: Assertion `BitWidth == RHS.BitWidth && "Comparison requires equal bit widths"' failed.
>
> in `LoopIdiomRecognize::processLoopMemCpy()` at the following comparison:
>
> // Check if the load stride matches the store stride.
> if (StrIntStride != LoadIntStride && StrIntStride != -LoadIntStride)
> return false;
>
> for a memcpy done between two address spaces with different pointer sizes.
>
> I don't have a upstream reproducer ready for this, but I'll see if I can create one.
The new version should fix the assertion I think. Let me know if you still see it.
================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:865
+ APInt LoadIntStride = LoadStride->getAPInt();
+ if (SizeInBytes != StoreIntStride && SizeInBytes != -StoreIntStride) {
+ ORE.emit([&]() {
----------------
lebedev.ri wrote:
> I don't think this should handle the case of different directions.
The different directions case is handled below in
```
// Check if the load stride matches the store stride.
if (StoreStrideInt != LoadStrideInt)
return false;
```
Or do you refer to something else?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D97667/new/
https://reviews.llvm.org/D97667
More information about the llvm-commits
mailing list