[PATCH] D38204: [TargetTransformInfo] Check if function pointer is valid before calling isLoweredToCall
Guozhi Wei via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 05:04:11 PDT 2017
Carrot created this revision.
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.
https://reviews.llvm.org/D38204
Files:
include/llvm/Analysis/TargetTransformInfoImpl.h
Index: include/llvm/Analysis/TargetTransformInfoImpl.h
===================================================================
--- include/llvm/Analysis/TargetTransformInfoImpl.h
+++ include/llvm/Analysis/TargetTransformInfoImpl.h
@@ -794,7 +794,7 @@
// A real function call is much slower.
if (auto *CI = dyn_cast<CallInst>(I)) {
const Function *F = CI->getCalledFunction();
- if (static_cast<T *>(this)->isLoweredToCall(F))
+ if (!F || static_cast<T *>(this)->isLoweredToCall(F))
return 40;
// Some intrinsics return a value and a flag, we use the value type
// to decide its latency.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38204.116427.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170925/1a5ce979/attachment.bin>
More information about the llvm-commits
mailing list