Update prebuilt Clang to match Android kernel.
Bug: 132428451
Change-Id: I8f6e2cb23f381fc0c02ddea99b867e58e925e5be
diff --git a/linux-x64/clang/include/llvm/Analysis/AliasAnalysis.h b/linux-x64/clang/include/llvm/Analysis/AliasAnalysis.h
index be3496b..4e55f01 100644
--- a/linux-x64/clang/include/llvm/Analysis/AliasAnalysis.h
+++ b/linux-x64/clang/include/llvm/Analysis/AliasAnalysis.h
@@ -1,9 +1,8 @@
//===- llvm/Analysis/AliasAnalysis.h - Alias Analysis Interface -*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
@@ -43,7 +42,6 @@
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/MemoryLocation.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
-#include "llvm/IR/CallSite.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
@@ -335,8 +333,7 @@
/// A convenience wrapper around the primary \c alias interface.
AliasResult alias(const Value *V1, const Value *V2) {
- return alias(V1, MemoryLocation::UnknownSize, V2,
- MemoryLocation::UnknownSize);
+ return alias(V1, LocationSize::unknown(), V2, LocationSize::unknown());
}
/// A trivial helper function to check to see if the specified pointers are
@@ -364,7 +361,8 @@
/// A convenience wrapper around the \c isMustAlias helper interface.
bool isMustAlias(const Value *V1, const Value *V2) {
- return alias(V1, 1, V2, 1) == MustAlias;
+ return alias(V1, LocationSize::precise(1), V2, LocationSize::precise(1)) ==
+ MustAlias;
}
/// Checks whether the given location points to constant memory, or if
@@ -382,15 +380,15 @@
/// \name Simple mod/ref information
/// @{
- /// Get the ModRef info associated with a pointer argument of a callsite. The
+ /// Get the ModRef info associated with a pointer argument of a call. The
/// result's bits are set to indicate the allowed aliasing ModRef kinds. Note
/// that these bits do not necessarily account for the overall behavior of
/// the function, but rather only provide additional per-argument
/// information. This never sets ModRefInfo::Must.
- ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx);
+ ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx);
/// Return the behavior of the given call site.
- FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS);
+ FunctionModRefBehavior getModRefBehavior(const CallBase *Call);
/// Return the behavior when calling the given function.
FunctionModRefBehavior getModRefBehavior(const Function *F);
@@ -406,8 +404,8 @@
/// property (e.g. calls to 'sin' and 'cos').
///
/// This property corresponds to the GCC 'const' attribute.
- bool doesNotAccessMemory(ImmutableCallSite CS) {
- return getModRefBehavior(CS) == FMRB_DoesNotAccessMemory;
+ bool doesNotAccessMemory(const CallBase *Call) {
+ return getModRefBehavior(Call) == FMRB_DoesNotAccessMemory;
}
/// Checks if the specified function is known to never read or write memory.
@@ -434,8 +432,8 @@
/// absence of interfering store instructions, such as CSE of strlen calls.
///
/// This property corresponds to the GCC 'pure' attribute.
- bool onlyReadsMemory(ImmutableCallSite CS) {
- return onlyReadsMemory(getModRefBehavior(CS));
+ bool onlyReadsMemory(const CallBase *Call) {
+ return onlyReadsMemory(getModRefBehavior(Call));
}
/// Checks if the specified function is known to only read from non-volatile
@@ -500,36 +498,12 @@
/// getModRefInfo (for call sites) - Return information about whether
/// a particular call site modifies or reads the specified memory location.
- ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc);
+ ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc);
/// getModRefInfo (for call sites) - A convenience wrapper.
- ModRefInfo getModRefInfo(ImmutableCallSite CS, const Value *P,
+ ModRefInfo getModRefInfo(const CallBase *Call, const Value *P,
LocationSize Size) {
- return getModRefInfo(CS, MemoryLocation(P, Size));
- }
-
- /// getModRefInfo (for calls) - Return information about whether
- /// a particular call modifies or reads the specified memory location.
- ModRefInfo getModRefInfo(const CallInst *C, const MemoryLocation &Loc) {
- return getModRefInfo(ImmutableCallSite(C), Loc);
- }
-
- /// getModRefInfo (for calls) - A convenience wrapper.
- ModRefInfo getModRefInfo(const CallInst *C, const Value *P,
- LocationSize Size) {
- return getModRefInfo(C, MemoryLocation(P, Size));
- }
-
- /// getModRefInfo (for invokes) - Return information about whether
- /// a particular invoke modifies or reads the specified memory location.
- ModRefInfo getModRefInfo(const InvokeInst *I, const MemoryLocation &Loc) {
- return getModRefInfo(ImmutableCallSite(I), Loc);
- }
-
- /// getModRefInfo (for invokes) - A convenience wrapper.
- ModRefInfo getModRefInfo(const InvokeInst *I, const Value *P,
- LocationSize Size) {
- return getModRefInfo(I, MemoryLocation(P, Size));
+ return getModRefInfo(Call, MemoryLocation(P, Size));
}
/// getModRefInfo (for loads) - Return information about whether
@@ -569,7 +543,7 @@
/// getModRefInfo (for cmpxchges) - A convenience wrapper.
ModRefInfo getModRefInfo(const AtomicCmpXchgInst *CX, const Value *P,
- unsigned Size) {
+ LocationSize Size) {
return getModRefInfo(CX, MemoryLocation(P, Size));
}
@@ -579,7 +553,7 @@
/// getModRefInfo (for atomicrmws) - A convenience wrapper.
ModRefInfo getModRefInfo(const AtomicRMWInst *RMW, const Value *P,
- unsigned Size) {
+ LocationSize Size) {
return getModRefInfo(RMW, MemoryLocation(P, Size));
}
@@ -626,8 +600,8 @@
ModRefInfo getModRefInfo(const Instruction *I,
const Optional<MemoryLocation> &OptLoc) {
if (OptLoc == None) {
- if (auto CS = ImmutableCallSite(I)) {
- return createModRefInfo(getModRefBehavior(CS));
+ if (const auto *Call = dyn_cast<CallBase>(I)) {
+ return createModRefInfo(getModRefBehavior(Call));
}
}
@@ -661,12 +635,12 @@
/// Return information about whether a call and an instruction may refer to
/// the same memory locations.
- ModRefInfo getModRefInfo(Instruction *I, ImmutableCallSite Call);
+ ModRefInfo getModRefInfo(Instruction *I, const CallBase *Call);
/// Return information about whether two call sites may refer to the same set
/// of memory locations. See the AA documentation for details:
/// http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
- ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2);
+ ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2);
/// Return information about whether a particular call site modifies
/// or reads the specified memory location \p MemLoc before instruction \p I
@@ -777,25 +751,25 @@
/// that these bits do not necessarily account for the overall behavior of
/// the function, but rather only provide additional per-argument
/// information.
- virtual ModRefInfo getArgModRefInfo(ImmutableCallSite CS,
+ virtual ModRefInfo getArgModRefInfo(const CallBase *Call,
unsigned ArgIdx) = 0;
/// Return the behavior of the given call site.
- virtual FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) = 0;
+ virtual FunctionModRefBehavior getModRefBehavior(const CallBase *Call) = 0;
/// Return the behavior when calling the given function.
virtual FunctionModRefBehavior getModRefBehavior(const Function *F) = 0;
/// getModRefInfo (for call sites) - Return information about whether
/// a particular call site modifies or reads the specified memory location.
- virtual ModRefInfo getModRefInfo(ImmutableCallSite CS,
+ virtual ModRefInfo getModRefInfo(const CallBase *Call,
const MemoryLocation &Loc) = 0;
/// Return information about whether two call sites may refer to the same set
/// of memory locations. See the AA documentation for details:
/// http://llvm.org/docs/AliasAnalysis.html#ModRefInfo
- virtual ModRefInfo getModRefInfo(ImmutableCallSite CS1,
- ImmutableCallSite CS2) = 0;
+ virtual ModRefInfo getModRefInfo(const CallBase *Call1,
+ const CallBase *Call2) = 0;
/// @}
};
@@ -827,26 +801,26 @@
return Result.pointsToConstantMemory(Loc, OrLocal);
}
- ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) override {
- return Result.getArgModRefInfo(CS, ArgIdx);
+ ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) override {
+ return Result.getArgModRefInfo(Call, ArgIdx);
}
- FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) override {
- return Result.getModRefBehavior(CS);
+ FunctionModRefBehavior getModRefBehavior(const CallBase *Call) override {
+ return Result.getModRefBehavior(Call);
}
FunctionModRefBehavior getModRefBehavior(const Function *F) override {
return Result.getModRefBehavior(F);
}
- ModRefInfo getModRefInfo(ImmutableCallSite CS,
+ ModRefInfo getModRefInfo(const CallBase *Call,
const MemoryLocation &Loc) override {
- return Result.getModRefInfo(CS, Loc);
+ return Result.getModRefInfo(Call, Loc);
}
- ModRefInfo getModRefInfo(ImmutableCallSite CS1,
- ImmutableCallSite CS2) override {
- return Result.getModRefInfo(CS1, CS2);
+ ModRefInfo getModRefInfo(const CallBase *Call1,
+ const CallBase *Call2) override {
+ return Result.getModRefInfo(Call1, Call2);
}
};
@@ -901,25 +875,28 @@
: CurrentResult.pointsToConstantMemory(Loc, OrLocal);
}
- ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
- return AAR ? AAR->getArgModRefInfo(CS, ArgIdx) : CurrentResult.getArgModRefInfo(CS, ArgIdx);
+ ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) {
+ return AAR ? AAR->getArgModRefInfo(Call, ArgIdx)
+ : CurrentResult.getArgModRefInfo(Call, ArgIdx);
}
- FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
- return AAR ? AAR->getModRefBehavior(CS) : CurrentResult.getModRefBehavior(CS);
+ FunctionModRefBehavior getModRefBehavior(const CallBase *Call) {
+ return AAR ? AAR->getModRefBehavior(Call)
+ : CurrentResult.getModRefBehavior(Call);
}
FunctionModRefBehavior getModRefBehavior(const Function *F) {
return AAR ? AAR->getModRefBehavior(F) : CurrentResult.getModRefBehavior(F);
}
- ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
- return AAR ? AAR->getModRefInfo(CS, Loc)
- : CurrentResult.getModRefInfo(CS, Loc);
+ ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc) {
+ return AAR ? AAR->getModRefInfo(Call, Loc)
+ : CurrentResult.getModRefInfo(Call, Loc);
}
- ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
- return AAR ? AAR->getModRefInfo(CS1, CS2) : CurrentResult.getModRefInfo(CS1, CS2);
+ ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2) {
+ return AAR ? AAR->getModRefInfo(Call1, Call2)
+ : CurrentResult.getModRefInfo(Call1, Call2);
}
};
@@ -951,11 +928,11 @@
return false;
}
- ModRefInfo getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
+ ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) {
return ModRefInfo::ModRef;
}
- FunctionModRefBehavior getModRefBehavior(ImmutableCallSite CS) {
+ FunctionModRefBehavior getModRefBehavior(const CallBase *Call) {
return FMRB_UnknownModRefBehavior;
}
@@ -963,11 +940,11 @@
return FMRB_UnknownModRefBehavior;
}
- ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc) {
+ ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc) {
return ModRefInfo::ModRef;
}
- ModRefInfo getModRefInfo(ImmutableCallSite CS1, ImmutableCallSite CS2) {
+ ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2) {
return ModRefInfo::ModRef;
}
};
@@ -1075,6 +1052,29 @@
void getAnalysisUsage(AnalysisUsage &AU) const override;
};
+/// A wrapper pass for external alias analyses. This just squirrels away the
+/// callback used to run any analyses and register their results.
+struct ExternalAAWrapperPass : ImmutablePass {
+ using CallbackT = std::function<void(Pass &, Function &, AAResults &)>;
+
+ CallbackT CB;
+
+ static char ID;
+
+ ExternalAAWrapperPass() : ImmutablePass(ID) {
+ initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
+ }
+
+ explicit ExternalAAWrapperPass(CallbackT CB)
+ : ImmutablePass(ID), CB(std::move(CB)) {
+ initializeExternalAAWrapperPassPass(*PassRegistry::getPassRegistry());
+ }
+
+ void getAnalysisUsage(AnalysisUsage &AU) const override {
+ AU.setPreservesAll();
+ }
+};
+
FunctionPass *createAAResultsWrapperPass();
/// A wrapper pass around a callback which can be used to populate the