[llvm] r290787 - [Inliner] remove unnecessary null checks from AddAlignmentAssumptions(); NFCI
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat Dec 31 09:54:06 PST 2016
Author: spatel
Date: Sat Dec 31 11:54:05 2016
New Revision: 290787
URL: http://llvm.org/viewvc/llvm-project?rev=290787&view=rev
Log:
[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.
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=290787&r1=290786&r2=290787&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/InlineFunction.cpp Sat Dec 31 11:54:05 2016
@@ -1097,9 +1097,8 @@ static void AddAliasScopeMetadata(CallSi
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(Call
CallInst *NewAssumption = IRBuilder<>(CS.getInstruction())
.CreateAlignmentAssumption(DL, Arg, Align);
- if (AC)
- AC->registerAssumption(NewAssumption);
+ AC->registerAssumption(NewAssumption);
}
}
}
More information about the llvm-commits
mailing list