This is an archive of the discontinued LLVM Phabricator instance.

[SROA] Fix APInt size when load/store have different address space
ClosedPublic

Authored by yaxunl on May 17 2017, 2:06 PM.

Details

Reviewers
arsenm
Summary

Currently there is a bug in SROA::presplitLoadsAndStores which causes assertion in
GEPOperator::accumulateConstantOffset.

Basically it does not consider the situation that the pointer operand of load or store
may be in a non-zero address space and its size may be different from the size of
a pointer in address space 0.

This patch fixes assertion when compiling Blender Cycles kernels for amdgpu backend.

Diff Detail

Event Timeline

yaxunl created this revision.May 17 2017, 2:06 PM
arsenm edited edge metadata.May 17 2017, 2:12 PM

Repeat of D32593?

Repeat of D32593?

The fix for the adjusted pointer type of load instruction is repeated in D32593, but the fix for APInt size is not in D32593.

sanjoy added a subscriber: sanjoy.May 21 2017, 11:38 PM
arsenm added a comment.Jun 7 2017, 1:37 PM

This needs a rebase now that D32593 is committed

yaxunl updated this revision to Diff 101944.Jun 8 2017, 11:04 AM
yaxunl retitled this revision from [SROA] Fix adjusted pointer type and APInt size when load/store have different address space to [SROA] Fix APInt size when load/store have different address space.
yaxunl edited the summary of this revision. (Show Details)

Rebased.

arsenm added inline comments.Jun 8 2017, 5:48 PM
lib/Transforms/Scalar/SROA.cpp
3626–3627

Assigning to an address space variable could save the ugly line wraps

yaxunl updated this revision to Diff 102033.Jun 9 2017, 7:51 AM
yaxunl marked an inline comment as done.

Fix format.

arsenm accepted this revision.Jun 9 2017, 7:52 AM

LGTM

This revision is now accepted and ready to land.Jun 9 2017, 7:52 AM
yaxunl closed this revision.Jun 12 2017, 9:47 AM