Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -675,14 +675,14 @@ static bool foldLoadsRecursive(Value *V, LoadOps &LOps, const DataLayout &DL,
Load2Ptr->stripAndAccumulateConstantOffsets(DL, Offset2,
/* AllowNonInbounds */ true);

// Verify if both loads have same base pointers and load sizes are same.
// Verify if both loads have same base pointers
uint64_t LoadSize1 = LI1->getType()->getPrimitiveSizeInBits();
uint64_t LoadSize2 = LI2->getType()->getPrimitiveSizeInBits();
if (Load1Ptr != Load2Ptr || LoadSize1 != LoadSize2)
if (Load1Ptr != Load2Ptr)
return false;

// Support Loadsizes greater or equal to 8bits and only power of 2.
if (LoadSize1 < 8 || !isPowerOf2_64(LoadSize1))
// Support Loadsizes greater or equal to 8bits.
if (LoadSize1 < 8 || LoadSize2 < 8)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what you want to check at this point is that typeSizeEqualsStoreSize for both loads. Please make sure that something like i9 plus i23 does not fold.

The sum being a power of two is already covered by the isTypeLegal check (well, or the target has non-pow2 legal integers, in which case there's no reason not to do the fold).

return false;

// Alias Analysis to check for stores b/w the loads.
Expand Down
Loading