From: David Blaikie Date: Mon, 20 Mar 2017 18:01:07 +0000 (+0000) Subject: Fix UB found by -Wtautological-undefined-compare X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f1cffb8e574dc2920faba8f044ff3b0ec3645e7;p=llvm Fix UB found by -Wtautological-undefined-compare git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298279 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 0f08d7f66fd..b486df8e818 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -1439,10 +1439,9 @@ static void updateCallProfile(Function *Callee, const ValueToValueMapTy &VMap, CalleeEntryCount.getValue()); for (auto const &Entry : VMap) - if (isa(Entry.first) && &*Entry.second != nullptr && - isa(Entry.second)) - cast(Entry.second) - ->updateProfWeight(CallCount, CalleeEntryCount.getValue()); + if (isa(Entry.first)) + if (auto *CI = dyn_cast_or_null(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))