Skip to content

Commit

Permalink
Merge commit 'e95d304fd362e68e985c9624ce5503099f63a3ee' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
dotnet-bot committed Dec 3, 2015
2 parents 3fac6fb + e95d304 commit 6e26222
Show file tree
Hide file tree
Showing 355 changed files with 10,252 additions and 4,379 deletions.
48 changes: 45 additions & 3 deletions docs/LangRef.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1289,9 +1289,9 @@ example:
that are recognized by LLVM to handle asynchronous exceptions, such
as SEH, will still provide their implementation defined semantics.
``optnone``
This function attribute indicates that the function is not optimized
by any optimization or code generator passes with the
exception of interprocedural optimization passes.
This function attribute indicates that most optimization passes will skip
this function, with the exception of interprocedural optimization passes.
Code generation defaults to the "fast" instruction selector.
This attribute cannot be used together with the ``alwaysinline``
attribute; this attribute is also incompatible
with the ``minsize`` attribute and the ``optsize`` attribute.
Expand Down Expand Up @@ -9337,6 +9337,48 @@ Semantics:

See the description for :ref:`llvm.stacksave <int_stacksave>`.

.. _int_get_dynamic_area_offset:

'``llvm.get.dynamic.area.offset``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Syntax:
"""""""

::

declare i32 @llvm.get.dynamic.area.offset.i32()
declare i64 @llvm.get.dynamic.area.offset.i64()

Overview:
"""""""""

The '``llvm.get.dynamic.area.offset.*``' intrinsic family is used to
get the offset from native stack pointer to the address of the most
recent dynamic alloca on the caller's stack. These intrinsics are
intendend for use in combination with
:ref:`llvm.stacksave <int_stacksave>` to get a
pointer to the most recent dynamic alloca. This is useful, for example,
for AddressSanitizer's stack unpoisoning routines.

Semantics:
""""""""""

These intrinsics return a non-negative integer value that can be used to
get the address of the most recent dynamic alloca, allocated by :ref:`alloca <i_alloca>`
on the caller's stack. In particular, for targets where stack grows downwards,
adding this offset to the native stack pointer would get the address of the most
recent dynamic alloca. For targets where stack grows upwards, the situation is a bit more
complicated, because substracting this value from stack pointer would get the address
one past the end of the most recent dynamic alloca.

Although for most targets `llvm.get.dynamic.area.offset <int_get_dynamic_area_offset>`
returns just a zero, for others, such as PowerPC and PowerPC64, it returns a
compile-time-known constant value.

The return value type of :ref:`llvm.get.dynamic.area.offset <int_get_dynamic_area_offset>`
must match the target's generic address space's (address space 0) pointer type.

'``llvm.prefetch``' Intrinsic
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
15 changes: 15 additions & 0 deletions include/llvm/ADT/STLExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,21 @@ bool all_of(R &&Range, UnaryPredicate &&P) {
std::forward<UnaryPredicate>(P));
}

/// Provide wrappers to std::any_of which take ranges instead of having to pass
/// begin/end explicitly.
template <typename R, class UnaryPredicate>
bool any_of(R &&Range, UnaryPredicate &&P) {
return std::any_of(Range.begin(), Range.end(),
std::forward<UnaryPredicate>(P));
}

/// Provide wrappers to std::find which take ranges instead of having to pass
/// begin/end explicitly.
template<typename R, class T>
auto find(R &&Range, const T &val) -> decltype(Range.begin()) {
return std::find(Range.begin(), Range.end(), val);
}

//===----------------------------------------------------------------------===//
// Extra additions to <memory>
//===----------------------------------------------------------------------===//
Expand Down
7 changes: 7 additions & 0 deletions include/llvm/ADT/StringMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,13 @@ class StringMap : public StringMapImpl {
: StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))),
Allocator(A) {}

StringMap(std::initializer_list<std::pair<StringRef, ValueTy>> List)
: StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {
for (const auto &P : List) {
insert(P);
}
}

StringMap(StringMap &&RHS)
: StringMapImpl(std::move(RHS)), Allocator(std::move(RHS.Allocator)) {}

Expand Down
5 changes: 5 additions & 0 deletions include/llvm/ADT/StringSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ namespace llvm {
class StringSet : public llvm::StringMap<char, AllocatorTy> {
typedef llvm::StringMap<char, AllocatorTy> base;
public:
StringSet() = default;
StringSet(std::initializer_list<StringRef> S) {
for (StringRef X : S)
insert(X);
}

std::pair<typename base::iterator, bool> insert(StringRef Key) {
assert(!Key.empty());
Expand Down
1 change: 1 addition & 0 deletions include/llvm/ADT/Triple.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class Triple {
enum SubArchType {
NoSubArch,

ARMSubArch_v8_2a,
ARMSubArch_v8_1a,
ARMSubArch_v8,
ARMSubArch_v7,
Expand Down
3 changes: 3 additions & 0 deletions include/llvm/Analysis/BranchProbabilityInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class BranchProbabilityInfo {
BranchProbability getEdgeProbability(const BasicBlock *Src,
const BasicBlock *Dst) const;

BranchProbability getEdgeProbability(const BasicBlock *Src,
succ_const_iterator Dst) const;

/// \brief Test if an edge is hot relative to other out-edges of the Src.
///
/// Check whether this edge out of the source block is 'hot'. We define hot
Expand Down
83 changes: 83 additions & 0 deletions include/llvm/Analysis/EHPersonalities.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//===- EHPersonalities.h - Compute EH-related information -----------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_ANALYSIS_EHPERSONALITIES_H
#define LLVM_ANALYSIS_EHPERSONALITIES_H

#include "llvm/Support/ErrorHandling.h"

namespace llvm {
class Function;
class Value;

enum class EHPersonality {
Unknown,
GNU_Ada,
GNU_C,
GNU_CXX,
GNU_ObjC,
MSVC_X86SEH,
MSVC_Win64SEH,
MSVC_CXX,
CoreCLR
};

/// \brief See if the given exception handling personality function is one
/// that we understand. If so, return a description of it; otherwise return
/// Unknown.
EHPersonality classifyEHPersonality(const Value *Pers);

/// \brief Returns true if this personality function catches asynchronous
/// exceptions.
inline bool isAsynchronousEHPersonality(EHPersonality Pers) {
// The two SEH personality functions can catch asynch exceptions. We assume
// unknown personalities don't catch asynch exceptions.
switch (Pers) {
case EHPersonality::MSVC_X86SEH:
case EHPersonality::MSVC_Win64SEH:
return true;
default:
return false;
}
llvm_unreachable("invalid enum");
}

/// \brief Returns true if this is a personality function that invokes
/// handler funclets (which must return to it).
inline bool isFuncletEHPersonality(EHPersonality Pers) {
switch (Pers) {
case EHPersonality::MSVC_CXX:
case EHPersonality::MSVC_X86SEH:
case EHPersonality::MSVC_Win64SEH:
case EHPersonality::CoreCLR:
return true;
default:
return false;
}
llvm_unreachable("invalid enum");
}

/// \brief Return true if this personality may be safely removed if there
/// are no invoke instructions remaining in the current function.
inline bool isNoOpWithoutInvoke(EHPersonality Pers) {
switch (Pers) {
case EHPersonality::Unknown:
return false;
// All known personalities currently have this behavior
default:
return true;
}
llvm_unreachable("invalid enum");
}

bool canSimplifyInvokeNoUnwind(const Function *F);

} // end namespace llvm

#endif
84 changes: 0 additions & 84 deletions include/llvm/Analysis/LibCallSemantics.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/llvm/Analysis/ScalarEvolution.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ namespace llvm {

protected:
SCEVPredicateKind Kind;
~SCEVPredicate() = default;
virtual ~SCEVPredicate();
SCEVPredicate(const SCEVPredicate&) = default;
SCEVPredicate &operator=(const SCEVPredicate&) = default;

Expand Down
18 changes: 13 additions & 5 deletions include/llvm/Analysis/TargetTransformInfoImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/Analysis/VectorUtils.h"

namespace llvm {

Expand Down Expand Up @@ -415,21 +416,28 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
(Ptr == nullptr ? 0 : Ptr->getType()->getPointerAddressSpace());
auto GTI = gep_type_begin(PointerType::get(PointeeType, AS), Operands);
for (auto I = Operands.begin(); I != Operands.end(); ++I, ++GTI) {
// We assume that the cost of Scalar GEP with constant index and the
// cost of Vector GEP with splat constant index are the same.
const ConstantInt *ConstIdx = dyn_cast<ConstantInt>(*I);
if (!ConstIdx)
if (auto Splat = getSplatValue(*I))
ConstIdx = dyn_cast<ConstantInt>(Splat);
if (isa<SequentialType>(*GTI)) {
int64_t ElementSize = DL.getTypeAllocSize(GTI.getIndexedType());
if (const ConstantInt *ConstIdx = dyn_cast<ConstantInt>(*I)) {
if (ConstIdx)
BaseOffset += ConstIdx->getSExtValue() * ElementSize;
} else {
else {
// Needs scale register.
if (Scale != 0) {
if (Scale != 0)
// No addressing mode takes two scale registers.
return TTI::TCC_Basic;
}
Scale = ElementSize;
}
} else {
StructType *STy = cast<StructType>(*GTI);
uint64_t Field = cast<ConstantInt>(*I)->getZExtValue();
// For structures the index is always splat or scalar constant
assert(ConstIdx && "Unexpected GEP index");
uint64_t Field = ConstIdx->getZExtValue();
BaseOffset += DL.getStructLayout(STy)->getElementOffset(Field);
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Analysis/VectorUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Value *findScalarElement(Value *V, unsigned EltNo);
/// \brief Get splat value if the input is a splat vector or return nullptr.
/// The value may be extracted from a splat constants vector or from
/// a sequence of instructions that broadcast a single value into a vector.
Value *getSplatValue(Value *V);
const Value *getSplatValue(const Value *V);

/// \brief Compute a map of integer instructions to their minimum legal type
/// size.
Expand Down
4 changes: 1 addition & 3 deletions include/llvm/Bitcode/ReaderWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,13 @@ namespace llvm {
DiagnosticHandlerFunction DiagnosticHandler);

/// Parse the specified bitcode buffer, returning the function info index.
/// If ExportingModule is true, check for functions in the index from this
/// module when the combined index is built during parsing and set flag.
/// If IsLazy is true, parse the entire function summary into
/// the index. Otherwise skip the function summary section, and only create
/// an index object with a map from function name to function summary offset.
/// The index is used to perform lazy function summary reading later.
ErrorOr<std::unique_ptr<FunctionInfoIndex>> getFunctionInfoIndex(
MemoryBufferRef Buffer, DiagnosticHandlerFunction DiagnosticHandler,
const Module *ExportingModule = nullptr, bool IsLazy = false);
bool IsLazy = false);

/// This method supports lazy reading of function summary data from the
/// combined index during function importing. When reading the combined index
Expand Down
6 changes: 6 additions & 0 deletions include/llvm/CodeGen/ISDOpcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,12 @@ namespace ISD {
GC_TRANSITION_START,
GC_TRANSITION_END,

/// GET_DYNAMIC_AREA_OFFSET - get offset from native SP to the address of
/// the most recent dynamic alloca. For most targets that would be 0, but
/// for some others (e.g. PowerPC, PowerPC64) that would be compile-time
/// known nonzero constant. The only operand here is the chain.
GET_DYNAMIC_AREA_OFFSET,

/// BUILTIN_OP_END - This must be the last enum value in this list.
/// The target-specific pre-isel opcode values start here.
BUILTIN_OP_END
Expand Down
Loading

0 comments on commit 6e26222

Please sign in to comment.