@@ -161,21 +161,23 @@ class FunctionArgPointeeTypeInfererence {
161
161
// Follow address space casts, we don't care about pointer address spaces
162
162
rankUsers (Current, Scores, CurrentScore);
163
163
} else if (auto CI = llvm::dyn_cast<llvm::CallBase>(Current)) {
164
- // Ugh, the value is forwarded as an argument into some other function, need
165
- // to continue looking there...
166
-
167
- // First, check if we have any interesting allocas in the called function
168
- scanAllocas (CI->getCalledFunction (), Scores);
169
-
170
- // Next, follow the argument that was passed in there
171
- for (int i = 0 ; i < CI->getCalledFunction ()->getFunctionType ()->getNumParams (); ++i) {
172
- if (CI->getArgOperand (i) == Parent) {
173
- auto Arg = CI->getCalledFunction ()->getArg (i);
174
- // Never, ever take into account the callee argument. This should never happen,
175
- // but if it does, it will go terribly because we will take into account users of functions,
176
- // not arguments anymore.
177
- if (!llvm::isa<llvm::Function>(Arg))
178
- rankUsers (Arg, Scores, CurrentScore);
164
+ if (CI->getCalledFunction ()) {
165
+ // Ugh, the value is forwarded as an argument into some other function, need
166
+ // to continue looking there...
167
+
168
+ // First, check if we have any interesting allocas in the called function
169
+ scanAllocas (CI->getCalledFunction (), Scores);
170
+
171
+ // Next, follow the argument that was passed in there
172
+ for (int i = 0 ; i < CI->getCalledFunction ()->getFunctionType ()->getNumParams (); ++i) {
173
+ if (CI->getArgOperand (i) == Parent) {
174
+ auto Arg = CI->getCalledFunction ()->getArg (i);
175
+ // Never, ever take into account the callee argument. This should never happen,
176
+ // but if it does, it will go terribly because we will take into account users of
177
+ // functions, not arguments anymore.
178
+ if (!llvm::isa<llvm::Function>(Arg))
179
+ rankUsers (Arg, Scores, CurrentScore);
180
+ }
179
181
}
180
182
}
181
183
}
0 commit comments