This is an archive of the discontinued LLVM Phabricator instance.

[LSR] Pointers with different address spaces are considered incompatible.
ClosedPublic

Authored by uabelho on Feb 13 2017, 1:26 AM.

Details

Summary

Function isCompatibleIVType is already used as a guard before the call to

SE.getMinusSCEV(OperExpr, PrevExpr);

in LSRInstance::ChainInstruction. getMinusSCEV requires the expressions
to be of the same type, so we now consider two pointers with different
address spaces to be incompatible, since it is possible that the pointers
in fact have different sizes.

Diff Detail

Repository
rL LLVM

Event Timeline

uabelho created this revision.Feb 13 2017, 1:26 AM

Very similar to https://reviews.llvm.org/D29717 but in LSR instead of LoopVectorize.

As I wrote in the commit message I haven't been able to reproduce this on an in-tree
target. If anyone knows a target where pointers in different address spaces have different
sizes, then I can probably fix a reproducer exposing a failed assertion in SCEV.

Ka-Ka added a subscriber: Ka-Ka.Feb 13 2017, 5:21 AM

After a hint from my colleague Ka-Ka (thanks!) I managed to reproduce the crash on "amdgcn--".

I'll update the patch with a test case tomorrow.

uabelho updated this revision to Diff 88192.Feb 13 2017, 6:16 AM
uabelho edited the summary of this revision. (Show Details)

Added test case. Without the fix the test case makes the compiler crash in SE.getMinusSCEV(OperExpr, PrevExpr);

This revision is now accepted and ready to land.Feb 13 2017, 7:11 AM
This revision was automatically updated to reflect the committed changes.