Page MenuHomePhabricator

[PatternMatch] Implement matching code for LibFunc
Needs ReviewPublic

Authored by Quolyk on Jan 14 2018, 11:16 PM.

Details

Summary

Provides m_LibFunc pattern that can be used to match LibFuncs.

Diff Detail

Event Timeline

Quolyk created this revision.Jan 14 2018, 11:16 PM

Up. I guess it still needs to be merged as it introduces pattern matching for LibFuncs that would be quite usefull.

Do you need to check whether the call is marked nobuiltin?

Quolyk updated this revision to Diff 155831.Jul 17 2018, 2:55 AM

Check if call isNoBuiltin

Is it possible to add some unit test for this?

Is it possible to add some unit test for this?

I have not seen that this header is explicitly tested, but it can be tested througn some libFunc pattern matches, as I hope to introduce some using this

Is it possible to add some unit test for this?

I have not seen that this header is explicitly tested, but it can be tested througn some libFunc pattern matches, as I hope to introduce some using this

unittests/IR/PatternMatch.cpp

efriedma added inline comments.Jul 17 2018, 10:48 AM
include/llvm/IR/PatternMatch.h
1633

Please use TargetLibraryInfo::getLibFunc(ImmutableCallSite CS, LibFunc &F) when possible, so we can avoid scattering validity checks all over the code. (This formulation misses the call to isValidProtoForLibFunc.)

Quolyk updated this revision to Diff 185035.Feb 4 2019, 6:26 AM

Use TargetLibraryInfo::getLibFunc.

Herald added a project: Restricted Project. · View Herald TranscriptFeb 4 2019, 6:26 AM
Quolyk retitled this revision from Pattern matching code for LibFunc to [PatternMatch] Implement matching code for LibFunc.Feb 4 2019, 6:27 AM
Quolyk edited the summary of this revision. (Show Details)
Quolyk added a reviewer: lebedev.ri.
Quolyk added a comment.Feb 4 2019, 6:30 AM

Is it possible to add some unit test for this?

I have not seen that this header is explicitly tested, but it can be tested througn some libFunc pattern matches, as I hope to introduce some using this

unittests/IR/PatternMatch.cpp

I don't see that all patterns are tested in that file. Instead, patterns are tested implicitly in optimization transforms.