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.
Details
Diff Detail
Event Timeline
Add FileCheck, so that we can see the problem even with release build. The original test will trigger assertion only on debug build.
The code looks fine, have a few minor nits on the test case.
test/Transforms/SROA/pr27557.ll | ||
---|---|---|
1 | @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 | You can probably remove the ModuleID bit. | |
11 | These show up inside the the optimized testKernel, right? If so, I'd suggest: ; CHECK-LABEL: @testKernel( < your CHECK: lines > |
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
@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.