Page MenuHomePhabricator

Add DWARF address spaces mapping for SPIR
ClosedPublic

Authored by jzzheng22 on May 25 2021, 9:27 AM.

Details

Summary

Extend debug info handling by adding DWARF address space mapping for SPIR, with corresponding test case.

Diff Detail

Event Timeline

jzzheng22 requested review of this revision.May 25 2021, 9:27 AM
jzzheng22 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptMay 25 2021, 9:27 AM
jzzheng22 updated this revision to Diff 347708.May 25 2021, 9:34 AM
stuart added a subscriber: stuart.May 26 2021, 4:02 AM
Anastasia added inline comments.May 26 2021, 4:06 AM
clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl
23

btw this variable is a duplicate of FileVar0 for your change. In clang parser:
global int *ptr;
is the same as
global int *global ptr;

The same applies to local variables of Type * and Type *private as they are equivalent on AST level too.

This is due to the address space inference rules if you are interested in more details: https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_C.html#addr-spaces-inference

Perhaps you could reduce the test case a bit by removing the duplicate testing?

Also I would suggest separating with empty lines every variable declaration with its corresponding CHECK line to improve the readability.

CHECK: <...>
Type var1;

CHECK: <...>
Type var2;
Anastasia added a subscriber: cfe-commits.
jzzheng22 updated this revision to Diff 348910.Jun 1 2021, 2:22 AM

Simplified test following review comments.

Anastasia accepted this revision.Jun 1 2021, 9:26 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Jun 1 2021, 9:26 AM
stuart added inline comments.Jun 4 2021, 8:44 AM
clang/test/CodeGenOpenCL/spir-debug-info-pointer-address-space.cl
23

In case this review feeds into changes made for other test files, it may be worth noting that the test in question uses OpenCL C 2.0 (-cl-std=CL2.0), and therefore the generic address space as the default in many contexts, rather than private. (This comment is made not for direct benefit for this review itself, but for the benefit of anyone who may be reading who is not already especially familiar with OpenCL address spaces.)

The duplicated testing has now been removed from the newly added test, though.

This revision was automatically updated to reflect the committed changes.