]> granicus.if.org Git - llvm/commitdiff
[Inliner] remove unnecessary null checks from AddAlignmentAssumptions(); NFCI
authorSanjay Patel <spatel@rotateright.com>
Sat, 31 Dec 2016 17:54:05 +0000 (17:54 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sat, 31 Dec 2016 17:54:05 +0000 (17:54 +0000)
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

index 66eb76b9ae95b6ee6f52c1f6b03a2f2800a25b01..a2ceded106b44159644df60cdfb9dc5cc22dc007 100644 (file)
@@ -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);
     }
   }
 }