This is an archive of the discontinued LLVM Phabricator instance.

SROA assertion: creating bitcast between ptr types with different addr spaces
ClosedPublic

Authored by liu12295 on Apr 28 2016, 5:08 PM.

Details

Summary

In SROA.cpp's canConvertValue() function, it will return "true" if both NewTy and OldTy are ptr type. Probably we need to check whether those two pointers are pointing to the same addr space; otherwise this will trigger an assertion later when SROA tries to create a bitcast between pointers with different addr spaces.

Diff Detail

Event Timeline

liu12295 updated this revision to Diff 55507.Apr 28 2016, 5:08 PM
liu12295 retitled this revision from to SROA assertion: creating bitcast between ptr types with different addr spaces.
liu12295 updated this object.
liu12295 added reviewers: sanjoy, chandlerc.
liu12295 set the repository for this revision to rL LLVM.
liu12295 added a subscriber: llvm-commits.
liu12295 updated this revision to Diff 55608.Apr 29 2016, 8:55 AM
liu12295 removed rL LLVM as the repository for this revision.

Add FileCheck, so that we can see the problem even with release build. The original test will trigger assertion only on debug build.

sanjoy requested changes to this revision.Apr 30 2016, 5:40 PM
sanjoy edited edge metadata.

The code looks fine, have a few minor nits on the test case.

test/Transforms/SROA/pr27557.ll
1 ↗(On Diff #55608)

@chandlerc 's suggestion of putting this in address-spaces.ll still stands. To make the PR number obvious, I'd suggest renaming @testKernel to @pr27557 instead.

3 ↗(On Diff #55608)

You can probably remove the ModuleID bit.

11 ↗(On Diff #55608)

These show up inside the the optimized testKernel, right? If so, I'd suggest:

; CHECK-LABEL: @testKernel(
< your CHECK: lines >
This revision now requires changes to proceed.Apr 30 2016, 5:40 PM
liu12295 updated this revision to Diff 55765.May 1 2016, 4:32 PM
liu12295 edited edge metadata.
liu12295 marked 3 inline comments as done.

Add unit test into existing address-spaces.ll

sanjoy accepted this revision.May 2 2016, 2:05 PM
sanjoy edited edge metadata.
This revision is now accepted and ready to land.May 2 2016, 2:05 PM
pxli168 added a subscriber: pxli168.May 2 2016, 7:52 PM
liu12295 closed this revision.May 3 2016, 11:20 AM

r268409

Function canConvertValue needs to check whether both NewTy and OldTy pointers are
pointing to the same addr space. This can prevent SROA from creating a bitcast
between pointers with different addr spaces.

Differential Revision: http://reviews.llvm.org/D19697