From a8cf3439422241532bd7d044c13f15ad6aed81bf Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Sat, 31 Dec 2016 17:54:05 +0000 Subject: [PATCH] [Inliner] remove unnecessary null checks from AddAlignmentAssumptions(); NFCI We bail out on the 1st line if the assumption cache is not set, so there's no need to check it after that. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290787 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Utils/InlineFunction.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp index 66eb76b9ae9..a2ceded106b 100644 --- a/lib/Transforms/Utils/InlineFunction.cpp +++ b/lib/Transforms/Utils/InlineFunction.cpp @@ -1097,9 +1097,8 @@ static void AddAliasScopeMetadata(CallSite CS, ValueToValueMapTy &VMap, static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI) { if (!PreserveAlignmentAssumptions || !IFI.GetAssumptionCache) return; - AssumptionCache *AC = IFI.GetAssumptionCache - ? &(*IFI.GetAssumptionCache)(*CS.getCaller()) - : nullptr; + + AssumptionCache *AC = &(*IFI.GetAssumptionCache)(*CS.getCaller()); auto &DL = CS.getCaller()->getParent()->getDataLayout(); // To avoid inserting redundant assumptions, we should check for assumptions @@ -1127,8 +1126,7 @@ static void AddAlignmentAssumptions(CallSite CS, InlineFunctionInfo &IFI) { CallInst *NewAssumption = IRBuilder<>(CS.getInstruction()) .CreateAlignmentAssumption(DL, Arg, Align); - if (AC) - AC->registerAssumption(NewAssumption); + AC->registerAssumption(NewAssumption); } } } -- 2.49.0