This is an archive of the discontinued LLVM Phabricator instance.

[TargetTransformInfo] Check if function pointer is valid before calling isLoweredToCall
ClosedPublic

Authored by Carrot on Sep 22 2017, 4:12 PM.

Details

Summary

Function isLoweredToCall can only accept non-null function pointer, but a function pointer can be null for indirect function call. So check it before calling isLoweredToCall from getInstructionLatency.

Diff Detail

Repository
rL LLVM

Event Timeline

Carrot created this revision.Sep 22 2017, 4:12 PM

Would it make sense to also add an assertion in isLoweredToCall asserting that F is non-null?

Also, is this something that can be tested? Something that shows the compiler doesn't segfault would be sufficient.

Also, please be sure to include full context with your patches. This is generally done with -U git option (e.g., git show HEAD -U999999 > mypatch.patch).

Would it make sense to also add an assertion in isLoweredToCall asserting that F is non-null?

Also, is this something that can be tested? Something that shows the compiler doesn't segfault would be sufficient.

done.

Carrot updated this revision to Diff 116574.Sep 25 2017, 10:49 AM
echristo accepted this revision.Oct 3 2017, 1:36 PM
echristo added a subscriber: echristo.

LGTM. Thanks!

This revision is now accepted and ready to land.Oct 3 2017, 1:36 PM
This revision was automatically updated to reflect the committed changes.