This is an archive of the discontinued LLVM Phabricator instance.

SelectionDAG: Fix a crash on inline asm when output register supports multiple types
ClosedPublic

Authored by • tstellarAMD on Mar 7 2016, 1:48 PM.

Details

Summary

The code in SelectionDAG did not handle the case where the
register type and output types were different, but had the same size.

Diff Detail

Event Timeline

• tstellarAMD retitled this revision from to SelectionDAG: Fix a crash on inline asm when output register supports multiple types.
• tstellarAMD updated this object.
• tstellarAMD added reviewers: arsenm, echristo.
• tstellarAMD added a subscriber: llvm-commits.
arsenm added inline comments.Mar 7 2016, 1:58 PM
test/CodeGen/AMDGPU/inline-asm.ll
50

Shouldn't this have an i1 return type?

• tstellarAMD added inline comments.Mar 7 2016, 2:17 PM
test/CodeGen/AMDGPU/inline-asm.ll
50

No, this test case comes from an inline asm implementation of hsail's activelanemask. I need to return a mask containing the true/false values for each thread. If I use i1, I will need to sign extend the value in order to store it, and I will get either 0 or -1 instead of the lane mask.

arsenm added inline comments.Mar 7 2016, 2:20 PM
test/CodeGen/AMDGPU/inline-asm.ll
50

Should probably add another testcase where it does use i1 then

• tstellarAMD added inline comments.Mar 8 2016, 8:30 AM
test/CodeGen/AMDGPU/inline-asm.ll
50

There is a different bug that prevents the i1 test from working, so I'll attach the test case to the fix for that bug.

echristo accepted this revision.Mar 8 2016, 11:26 PM
echristo edited edge metadata.

Looks reasonable. Can you comment the function a bit as well so that the logic is more clear? (And commit when you've done so)

Thanks!

-eric

This revision is now accepted and ready to land.Mar 8 2016, 11:26 PM
This revision was automatically updated to reflect the committed changes.