This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by liu12295 on Apr 28 2016, 12:15 PM.

Details

Reviewers
chandlerc
sanjoy
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 55454.Apr 28 2016, 12:15 PM
liu12295 retitled this revision from to SROA assertion: creating bitcast between ptr types with different addr spaces.
liu12295 updated this object.
liu12295 set the repository for this revision to rL LLVM.
liu12295 changed the visibility from "Public (No Login Required)" to "liu12295 (Jack Liu)".
liu12295 changed the visibility from "liu12295 (Jack Liu)" to "Public (No Login Required)".Apr 28 2016, 12:22 PM
sanjoy added a subscriber: llvm-commits.
sanjoy requested changes to this revision.Apr 28 2016, 12:29 PM
sanjoy edited edge metadata.
sanjoy added inline comments.
lib/Transforms/Scalar/SROA.cpp
1638–1641

This line is too long -- can you wrap it to 80 chars?

http://llvm.org/docs/CodingStandards.html#source-code-width

test/Transforms/SROA/address-spaces-1.ll
1 ↗(On Diff #55454)

Given that you've filed a PR, it is better to name the test as prXXXX.ll. Also don't use -O3 here -- you should just invoke the pass you're unit testing (SROA in this case).

An easy way to do this is to use -print-before-all to get the IR right before SROA crashed.

13 ↗(On Diff #55454)

Can you shrink this test case to be more to the point?

This revision now requires changes to proceed.Apr 28 2016, 12:29 PM
liu12295 updated this revision to Diff 55486.Apr 28 2016, 2:20 PM
liu12295 edited edge metadata.
liu12295 removed rL LLVM as the repository for this revision.

This revision addresses the raised concerns.

chandlerc edited edge metadata.Apr 28 2016, 3:13 PM

Note that this patch didn't actually go to the mailing list when you created it, so now the mailing list is missing context on what this patch is even doing. The first email is from Sanjoy.

test/Transforms/SROA/address-spaces-1.ll
1 ↗(On Diff #55454)

Please don't name the file 'prXXXX.ll' or add a new file at all.

Naming test files after 'pr....' encourages to have more smaller test files when each file adds substantial overhead.

Instead we should be trying to find an existing overarching test file and add the tests to it. Perhaps the 'address-spaces.ll'?

liu12295 abandoned this revision.Apr 28 2016, 5:02 PM

Will start a new one.