[llvm] r298279 - Fix UB found by -Wtautological-undefined-compare
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 20 11:01:07 PDT 2017
Author: dblaikie
Date: Mon Mar 20 13:01:07 2017
New Revision: 298279
URL: http://llvm.org/viewvc/llvm-project?rev=298279&view=rev
Log:
Fix UB found by -Wtautological-undefined-compare
Modified:
llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
Modified: llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp?rev=298279&r1=298278&r2=298279&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Mon Mar 20 13:01:07 2017
@@ -1439,10 +1439,9 @@ static void updateCallProfile(Function *
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))
More information about the llvm-commits
mailing list