[llvm] r306351 - [CFLAA] Use raw pointers instead of Optional<Pointer>. NFC.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 26 17:33:37 PDT 2017
Author: davide
Date: Mon Jun 26 17:33:37 2017
New Revision: 306351
URL: http://llvm.org/viewvc/llvm-project?rev=306351&view=rev
Log:
[CFLAA] Use raw pointers instead of Optional<Pointer>. NFC.
Using Optional<> here doesn't seem to be terribly valuable, but
this is not the main point of this change. The change enables
us to merge the (now) two identical copies of parentFunctionOfValue()
that Steensgaard's and Andersens' provide.
Modified:
llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp?rev=306351&r1=306350&r2=306351&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/CFLSteensAliasAnalysis.cpp Mon Jun 26 17:33:37 2017
@@ -90,7 +90,7 @@ const StratifiedIndex StratifiedLink::Se
/// Determines whether it would be pointless to add the given Value to our sets.
static bool canSkipAddingToSets(Value *Val);
-static Optional<Function *> parentFunctionOfValue(Value *Val) {
+static Function *parentFunctionOfValue(Value *Val) {
if (auto *Inst = dyn_cast<Instruction>(Val)) {
auto *Bb = Inst->getParent();
return Bb->getParent();
@@ -98,7 +98,7 @@ static Optional<Function *> parentFuncti
if (auto *Arg = dyn_cast<Argument>(Val))
return Arg->getParent();
- return None;
+ return nullptr;
}
static bool canSkipAddingToSets(Value *Val) {
@@ -281,9 +281,9 @@ AliasResult CFLSteensAAResult::query(con
return NoAlias;
Function *Fn = nullptr;
- auto MaybeFnA = parentFunctionOfValue(ValA);
- auto MaybeFnB = parentFunctionOfValue(ValB);
- if (!MaybeFnA.hasValue() && !MaybeFnB.hasValue()) {
+ Function *MaybeFnA = parentFunctionOfValue(ValA);
+ Function *MaybeFnB = parentFunctionOfValue(ValB);
+ if (!MaybeFnA && !MaybeFnB) {
// The only times this is known to happen are when globals + InlineAsm are
// involved
DEBUG(dbgs()
@@ -291,12 +291,12 @@ AliasResult CFLSteensAAResult::query(con
return MayAlias;
}
- if (MaybeFnA.hasValue()) {
- Fn = *MaybeFnA;
- assert((!MaybeFnB.hasValue() || *MaybeFnB == *MaybeFnA) &&
+ if (MaybeFnA) {
+ Fn = MaybeFnA;
+ assert((!MaybeFnB || MaybeFnB == MaybeFnA) &&
"Interprocedural queries not supported");
} else {
- Fn = *MaybeFnB;
+ Fn = MaybeFnB;
}
assert(Fn != nullptr);
More information about the llvm-commits
mailing list