Fix UB found by -Wtautological-undefined-compare

llvm-svn: 298279
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 0f08d7f..b486df8 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1439,10 +1439,9 @@
                CalleeEntryCount.getValue());
 
   for (auto const &Entry : VMap)
-    if (isa<CallInst>(Entry.first) && &*Entry.second != nullptr &&
-        isa<CallInst>(Entry.second))
-      cast<CallInst>(Entry.second)
-          ->updateProfWeight(CallCount, CalleeEntryCount.getValue());
+    if (isa<CallInst>(Entry.first))
+      if (auto *CI = dyn_cast_or_null<CallInst>(Entry.second))
+        CI->updateProfWeight(CallCount, CalleeEntryCount.getValue());
   for (BasicBlock &BB : *Callee)
     // No need to update the callsite if it is pruned during inlining.
     if (VMap.count(&BB))