This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU][NFC] Skip processing intrinsics that do not become real instructions
ClosedPublic

Authored by dfukalov on Jun 5 2020, 6:47 AM.

Diff Detail

Event Timeline

dfukalov created this revision.Jun 5 2020, 6:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 5 2020, 6:47 AM
dfukalov updated this revision to Diff 268858.Jun 5 2020, 9:58 AM

fixed typo

Does this solve any concrete problem? If so it needs a testcase

This comment was removed by rampitec.
This comment was removed by rampitec.

Does this solve any concrete problem? If so it needs a testcase

I agree, it needs a test.

dfukalov retitled this revision from [AMDGPU] Skip processing intrinsics that do not become real instructions to [AMDGPU][NFC] Skip processing intrinsics that do not become real instructions.Jun 5 2020, 12:35 PM
dfukalov added a comment.EditedJun 5 2020, 12:38 PM

Phabricator somehow shows wrong diff after patch update. Correct diff is

-       if (!CI) continue;
+       if (!CI || isa<DbgInfoIntrinsic>(CI) || CI->isLifetimeStartOrEnd())
+         continue;

There were no issues, I just noticed in debug output that that pass tries to process staff like llvm.lifetime.start

arsenm added inline comments.Jun 5 2020, 1:00 PM
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
1729

Can also use instructionsWithoutDebug iterator instead

But how did it work?! It should have skipped any call which is not a lifetime intrinsic.

But how did it work?! It should have skipped any call which is not a lifetime intrinsic.

It parsed function name and realized that it is not a mangled library function

But how did it work?! It should have skipped any call which is not a lifetime intrinsic.

It parsed function name and realized that it is not a mangled library function

I assume it never did anything to a library function on which it were supposed to work, not since that check was added.

Which means we have no single test for that. Which in turn means we need to add this test now.

dfukalov updated this revision to Diff 268973.Jun 5 2020, 5:43 PM

test added

dfukalov updated this revision to Diff 268974.Jun 5 2020, 5:48 PM

added test

dfukalov marked 2 inline comments as done.Jun 5 2020, 5:55 PM
This comment was removed by dfukalov.
llvm/lib/Target/AMDGPU/AMDGPULibCalls.cpp
1729

We cannot use simple range iterator here since BB can be modified in the loop

dfukalov updated this revision to Diff 268979.Jun 5 2020, 6:01 PM
dfukalov marked an inline comment as done.

diff reuploaded

Hmm... I did not mean that. I meant we seem to miss a test the pass does what it expected to do, not that it skips what it should not process.

There are the tests in llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll

There are the tests in llvm/test/CodeGen/AMDGPU/simplify-libcalls.ll

How does that work? This is a simple thing: this code shall never been executed given the reverted condition. Your change is absolutely right, but what did it start to execute which so obviously was not executed and tested before?

rampitec accepted this revision.Jun 8 2020, 11:10 AM

OK, I was looking into different versions of this diff. LGTM.

This revision is now accepted and ready to land.Jun 8 2020, 11:10 AM
This revision was automatically updated to reflect the committed changes.