From 1f1cffb8e574dc2920faba8f044ff3b0ec3645e7 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Mon, 20 Mar 2017 18:01:07 +0000 Subject: [PATCH] Fix UB found by -Wtautological-undefined-compare git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298279 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/InlineFunction.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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)) -- 2.40.0