This is an archive of the discontinued LLVM Phabricator instance.

[FIX] 26194 - LLVM crash in CXXNameMangler::mangleType
Needs ReviewPublic

Authored by ichesnokov on Jan 25 2016, 9:39 AM.

Details

Summary

Please review and submit.

Diff Detail

Event Timeline

ichesnokov retitled this revision from to AXT-Ball game.
ichesnokov updated this object.
ichesnokov set the repository for this revision to rL LLVM.
ichesnokov retitled this revision from AXT-Ball game to Untitled.Jan 26 2016, 12:28 AM
ichesnokov retitled this revision from Untitled to [FIX] 26194 - LLVM crash in CXXNameMangler::mangleType.
ichesnokov added reviewers: asl, pxli168, ABataev.

The patch crash LLVM crash in CXXNameMangler.mangleType.patch

asl added inline comments.Jan 26 2016, 3:13 AM
test/CodeGenOpenCL/generic_type_cl20.cl
1 ↗(On Diff #45961)

Are you sure you need this cmdline? Please reduce down to minimum subset.

5 ↗(On Diff #45961)

You need to test the mangling. Please implement it.

ichesnokov added inline comments.Jan 26 2016, 4:07 AM
test/CodeGenOpenCL/generic_type_cl20.cl
1 ↗(On Diff #45961)

Bug author wrote: "...and it's still crashing in the same place. Please try invoking with the precise arguments i wrote in "To reproduce".. and on the attached CL file, not pocl codebase - i've mentioned pocl for reference, but pocl doesn't currently work with 3.8 (yet)..."

asl added inline comments.Jan 26 2016, 4:09 AM
test/CodeGenOpenCL/generic_type_cl20.cl
1 ↗(On Diff #45961)

The author might wrote whatever he / she wants. But this does not mean that you should not reduce the testcase.

pxli168 added inline comments.Jan 26 2016, 8:58 PM
lib/AST/ItaniumMangle.cpp
1799

As you said in the bug commit, you can try to fix the windows part too.

Try it in MicrosoftMangle.cpp

test/CodeGenOpenCL/generic_type_cl20.cl
1 ↗(On Diff #45961)

I think you can merge this test in test/CodeGenOpenCL/address-spaces-mangling.c. You need not to reproduce the bug case here.

You can refer to other test relate to opencl 2.0 and use something like

#ifdef CL20
void test(int4 x)
#endif
ichesnokov added inline comments.Jan 28 2016, 2:38 AM
test/CodeGenOpenCL/generic_mangling.cl
5 ↗(On Diff #46251)

I found no way to register the operation inside CL function, thus I post simplier diff, without mangling verification.

ichesnokov added inline comments.Jan 28 2016, 2:52 AM
lib/AST/ItaniumMangle.cpp
1799

The Windows mangler is pretty different and doesn't have this issue.

Local variables are always generic if not specified explicitly.
And I found no method to supply address space of local variable, only of whole function.

Please review the patch and commit.
BugZilla link: https://llvm.org/bugs/show_bug.cgi?id=26194

Please review and commit.

ichesnokov added inline comments.Jan 31 2016, 1:09 AM
lib/AST/ItaniumMangle.cpp
1799

I'll try to fix on the Windows.

ichesnokov removed rL LLVM as the repository for this revision.

Added generic variable support and checking address space to Microsoft mangler.
Test case updated.

pxli168 added inline comments.Feb 1 2016, 6:58 PM
test/CodeGenOpenCL/generic_mangling.cl
1 ↗(On Diff #46532)

Is this enough for the new added MicrosoftMangle?

tools/driver/driver.cpp
367 ↗(On Diff #46532)

I think this dubug use shuold not be in the patch.

Please support discussion about MicrosoftMangle+CL at
https://llvm.org/bugs/show_bug.cgi?id=26194

tools/driver/driver.cpp
367 ↗(On Diff #46532)

Yes, this is enough to work with MicrosoftMangler.
However I am in doubt about this implentation.
Please forward discussion at https://llvm.org/bugs/show_bug.cgi?id=26194

ichesnokov updated this object.

This diff adds mangling check test cases for Itanium and Microsoft manglers

I noticed that MicrosoftMangler already has many extension functions. I.e. this MicrosoftMangler.cpp change is Ok.
Please review and accept/commit.

Please review the last version of patch.

Anastasia added inline comments.Feb 9 2016, 10:04 AM
lib/AST/MicrosoftMangle.cpp
1386

I was just wondering since this code appears to be a repetition from ItaniumMangler.cpp, could we just factor it out to a common function.

I think Mangler.cpp could be a good place for having its definition then next to ObjC specific functions (see for example mangleObjCMethodName()). We would just have to update comments in this file accordingly to reflect that it now contains OpenCL and CUDA functionality as well.

test/CodeGenOpenCL/generic-mangling-itanium.cl
1

Could we extend test/CodeGenOpenCL/address-spaces-mangling.cl instead of adding another file?

5

Did you mean to test generic not global?

test/CodeGenOpenCL/generic-mangling-microsoft.cl
1

I would very much like to have test/CodeGenOpenCL/address-spaces-mangling.cl extended here too. You can just add a new RUN line along with a new -check-prefix option.

Anastasia resigned from this revision.Jul 12 2016, 10:14 AM
Anastasia removed a reviewer: Anastasia.