Skip to content

Commit

Permalink
SWDEV-179954 - OpenCL/LC - Merge branch amd-master into amd-common
Browse files Browse the repository at this point in the history
Change-Id: I16c1d0cdf3f1d1129d5230f48282460b5904d1c2
  • Loading branch information
Jenkins committed Jun 12, 2019
2 parents 742a194 + 93a64c9 commit 595b180
Show file tree
Hide file tree
Showing 138 changed files with 5,139 additions and 1,003 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ autoconf/autom4te.cache
/CMakeSettings.json
# CLion project configuration
/.idea
# Qt Creator project configuration
/CMakeLists.txt.user

#==============================================================================#
# Directories to ignore (do not add trailing '/'s, they skip symlinks).
Expand Down
26 changes: 13 additions & 13 deletions bindings/go/llvm/dibuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,11 @@ func (d *DIBuilder) CreateBasicType(t DIBasicType) Metadata {

// DIPointerType holds the values for creating pointer type debug metadata.
type DIPointerType struct {
Pointee Metadata
SizeInBits uint64
AlignInBits uint32 // optional
Pointee Metadata
SizeInBits uint64
AlignInBits uint32 // optional
AddressSpace uint32
Name string // optional
Name string // optional
}

// CreatePointerType creates a type that represents a pointer to another type.
Expand Down Expand Up @@ -355,14 +355,14 @@ func (d *DIBuilder) CreateSubroutineType(t DISubroutineType) Metadata {

// DIStructType holds the values for creating struct type debug metadata.
type DIStructType struct {
Name string
File Metadata
Line int
SizeInBits uint64
AlignInBits uint32
Flags int
DerivedFrom Metadata
Elements []Metadata
Name string
File Metadata
Line int
SizeInBits uint64
AlignInBits uint32
Flags int
DerivedFrom Metadata
Elements []Metadata
VTableHolder Metadata // optional
UniqueID string
}
Expand Down Expand Up @@ -581,7 +581,7 @@ func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, l DebugL
}

func (v Value) SetSubprogram(sp Metadata) {
C.LLVMSetSubprogram(v.C, sp.C)
C.LLVMSetSubprogram(v.C, sp.C)
}

func boolToCInt(v bool) C.int {
Expand Down
95 changes: 48 additions & 47 deletions bindings/go/llvm/ir.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,49 +384,49 @@ func AttributeKindID(name string) (id uint) {
}

func (c Context) CreateEnumAttribute(kind uint, val uint64) (a Attribute) {
a.C = C.LLVMCreateEnumAttribute(c.C, C.unsigned(kind), C.uint64_t(val))
return
a.C = C.LLVMCreateEnumAttribute(c.C, C.unsigned(kind), C.uint64_t(val))
return
}

func (a Attribute) GetEnumKind() (id int) {
id = int(C.LLVMGetEnumAttributeKind(a.C))
return
id = int(C.LLVMGetEnumAttributeKind(a.C))
return
}

func (a Attribute) GetEnumValue() (val uint64) {
val = uint64(C.LLVMGetEnumAttributeValue(a.C))
return
val = uint64(C.LLVMGetEnumAttributeValue(a.C))
return
}

func (c Context) CreateStringAttribute(kind string, val string) (a Attribute) {
ckind := C.CString(kind)
defer C.free(unsafe.Pointer(ckind))
cval := C.CString(val)
defer C.free(unsafe.Pointer(cval))
a.C = C.LLVMCreateStringAttribute(c.C,
ckind, C.unsigned(len(kind)),
cval, C.unsigned(len(val)))
return
ckind := C.CString(kind)
defer C.free(unsafe.Pointer(ckind))
cval := C.CString(val)
defer C.free(unsafe.Pointer(cval))
a.C = C.LLVMCreateStringAttribute(c.C,
ckind, C.unsigned(len(kind)),
cval, C.unsigned(len(val)))
return
}

func (a Attribute) GetStringKind() string {
length := C.unsigned(0)
ckind := C.LLVMGetStringAttributeKind(a.C, &length)
return C.GoStringN(ckind, C.int(length))
length := C.unsigned(0)
ckind := C.LLVMGetStringAttributeKind(a.C, &length)
return C.GoStringN(ckind, C.int(length))
}

func (a Attribute) GetStringValue() string {
length := C.unsigned(0)
ckind := C.LLVMGetStringAttributeValue(a.C, &length)
return C.GoStringN(ckind, C.int(length))
length := C.unsigned(0)
ckind := C.LLVMGetStringAttributeValue(a.C, &length)
return C.GoStringN(ckind, C.int(length))
}

func (a Attribute) IsEnum() bool {
return C.LLVMIsEnumAttribute(a.C) != 0;
return C.LLVMIsEnumAttribute(a.C) != 0
}

func (a Attribute) IsString() bool {
return C.LLVMIsStringAttribute(a.C) != 0;
return C.LLVMIsStringAttribute(a.C) != 0
}

//-------------------------------------------------------------------------
Expand Down Expand Up @@ -1150,36 +1150,36 @@ func (v Value) SetGC(name string) {
C.LLVMSetGC(v.C, cname)
}
func (v Value) AddAttributeAtIndex(i int, a Attribute) {
C.LLVMAddAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), a.C)
C.LLVMAddAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), a.C)
}
func (v Value) AddFunctionAttr(a Attribute) {
v.AddAttributeAtIndex(C.LLVMAttributeFunctionIndex, a);
v.AddAttributeAtIndex(C.LLVMAttributeFunctionIndex, a)
}
func (v Value) GetEnumAttributeAtIndex(i int, kind uint) (a Attribute) {
a.C = C.LLVMGetEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
return
a.C = C.LLVMGetEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
return
}
func (v Value) GetEnumFunctionAttribute(kind uint) Attribute {
return v.GetEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
return v.GetEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
}
func (v Value) GetStringAttributeAtIndex(i int, kind string) (a Attribute) {
ckind := C.CString(kind)
defer C.free(unsafe.Pointer(ckind))
a.C = C.LLVMGetStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
ckind, C.unsigned(len(kind)))
return
ckind := C.CString(kind)
defer C.free(unsafe.Pointer(ckind))
a.C = C.LLVMGetStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
ckind, C.unsigned(len(kind)))
return
}
func (v Value) RemoveEnumAttributeAtIndex(i int, kind uint) {
C.LLVMRemoveEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
C.LLVMRemoveEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
}
func (v Value) RemoveEnumFunctionAttribute(kind uint) {
v.RemoveEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind);
v.RemoveEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
}
func (v Value) RemoveStringAttributeAtIndex(i int, kind string) {
ckind := C.CString(kind)
defer C.free(unsafe.Pointer(ckind))
C.LLVMRemoveStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
ckind, C.unsigned(len(kind)))
ckind := C.CString(kind)
defer C.free(unsafe.Pointer(ckind))
C.LLVMRemoveStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
ckind, C.unsigned(len(kind)))
}
func (v Value) AddTargetDependentFunctionAttr(attr, value string) {
cattr := C.CString(attr)
Expand All @@ -1201,12 +1201,12 @@ func (v Value) Params() []Value {
}
return out
}
func (v Value) Param(i int) (rv Value) { rv.C = C.LLVMGetParam(v.C, C.unsigned(i)); return }
func (v Value) ParamParent() (rv Value) { rv.C = C.LLVMGetParamParent(v.C); return }
func (v Value) FirstParam() (rv Value) { rv.C = C.LLVMGetFirstParam(v.C); return }
func (v Value) LastParam() (rv Value) { rv.C = C.LLVMGetLastParam(v.C); return }
func NextParam(v Value) (rv Value) { rv.C = C.LLVMGetNextParam(v.C); return }
func PrevParam(v Value) (rv Value) { rv.C = C.LLVMGetPreviousParam(v.C); return }
func (v Value) Param(i int) (rv Value) { rv.C = C.LLVMGetParam(v.C, C.unsigned(i)); return }
func (v Value) ParamParent() (rv Value) { rv.C = C.LLVMGetParamParent(v.C); return }
func (v Value) FirstParam() (rv Value) { rv.C = C.LLVMGetFirstParam(v.C); return }
func (v Value) LastParam() (rv Value) { rv.C = C.LLVMGetLastParam(v.C); return }
func NextParam(v Value) (rv Value) { rv.C = C.LLVMGetNextParam(v.C); return }
func PrevParam(v Value) (rv Value) { rv.C = C.LLVMGetPreviousParam(v.C); return }
func (v Value) SetParamAlignment(align int) { C.LLVMSetParamAlignment(v.C, C.unsigned(align)) }

// Operations on basic blocks
Expand Down Expand Up @@ -1351,10 +1351,11 @@ func (b Builder) Dispose() { C.LLVMDisposeBuilder(b.C) }

// Metadata
type DebugLoc struct {
Line, Col uint
Scope Metadata
InlinedAt Metadata
Line, Col uint
Scope Metadata
InlinedAt Metadata
}

func (b Builder) SetCurrentDebugLocation(line, col uint, scope, inlinedAt Metadata) {
C.LLVMGoSetCurrentDebugLocation(b.C, C.unsigned(line), C.unsigned(col), scope.C, inlinedAt.C)
}
Expand Down
8 changes: 4 additions & 4 deletions bindings/go/llvm/transforms_coroutines.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package llvm
*/
import "C"

func (pm PassManager) AddCoroEarlyPass() { C.LLVMAddCoroEarlyPass(pm.C) }
func (pm PassManager) AddCoroSplitPass() { C.LLVMAddCoroSplitPass(pm.C) }
func (pm PassManager) AddCoroElidePass() { C.LLVMAddCoroElidePass(pm.C) }
func (pm PassManager) AddCoroCleanupPass() { C.LLVMAddCoroCleanupPass(pm.C) }
func (pm PassManager) AddCoroEarlyPass() { C.LLVMAddCoroEarlyPass(pm.C) }
func (pm PassManager) AddCoroSplitPass() { C.LLVMAddCoroSplitPass(pm.C) }
func (pm PassManager) AddCoroElidePass() { C.LLVMAddCoroElidePass(pm.C) }
func (pm PassManager) AddCoroCleanupPass() { C.LLVMAddCoroCleanupPass(pm.C) }
4 changes: 2 additions & 2 deletions docs/CommandGuide/llvm-nm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ OPTIONS

.. option:: --print-size, -S

Show symbol size instead of address.
Show symbol size as well as address (not applicable for Mach-O).

.. option:: --size-sort

Expand All @@ -134,7 +134,7 @@ OPTIONS
.. option:: --radix=RADIX, -t

Specify the radix of the symbol address(es). Values accepted d(decimal),
x(hexadecomal) and o(octal).
x(hexadecimal) and o(octal).

BUGS
----
Expand Down
5 changes: 3 additions & 2 deletions docs/CommandGuide/llvm-symbolizer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ OPTIONS
.. option:: -inlining, -inlines, -i

If a source code location is in an inlined function, prints all the
inlnied frames. Defaults to true.
inlined frames. Defaults to true.

.. option:: -default-arch

Expand Down Expand Up @@ -172,4 +172,5 @@ OPTIONS
EXIT STATUS
-----------

:program:`llvm-symbolizer` returns 0. Other exit codes imply internal program error.
:program:`llvm-symbolizer` returns 0. Other exit codes imply an internal program
error.
18 changes: 9 additions & 9 deletions docs/GetElementPtr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ therefore be indexed and requires an index operand. Consider this example:
P[0].f1 = P[1].f1 + P[2].f2;
}
...
munger_struct Array[3];
struct munger_struct Array[3];
...
munge(Array);
Expand All @@ -88,15 +88,15 @@ looks like:

.. code-block:: llvm
void %munge(%struct.munger_struct* %P) {
define void @munge(%struct.munger_struct* %P) {
entry:
%tmp = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 1, i32 0
%tmp = load i32* %tmp
%tmp6 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
%tmp7 = load i32* %tmp6
%tmp8 = add i32 %tmp7, %tmp
%tmp9 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
store i32 %tmp8, i32* %tmp9
%tmp1 = load i32, i32* %tmp
%tmp2 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
%tmp3 = load i32, i32* %tmp2
%tmp4 = add i32 %tmp3, %tmp1
%tmp5 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
store i32 %tmp4, i32* %tmp5
ret void
}
Expand Down Expand Up @@ -199,7 +199,7 @@ following:
.. code-block:: text
%idx = getelementptr { [40 x i32]* }, { [40 x i32]* }* %, i64 0, i32 0
%arr = load [40 x i32]** %idx
%arr = load [40 x i32]*, [40 x i32]** %idx
%idx = getelementptr [40 x i32], [40 x i32]* %arr, i64 0, i64 17
In this case, we have to load the pointer in the structure with a load
Expand Down
50 changes: 41 additions & 9 deletions include/llvm-c/lto.h
Original file line number Diff line number Diff line change
Expand Up @@ -297,14 +297,6 @@ lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
extern const char*
lto_module_get_linkeropts(lto_module_t mod);

/**
* Returns the module's dependent library specifiers.
*
* \since LTO_API_VERSION=24
*/
extern const char*
lto_module_get_dependent_libraries(lto_module_t mod);

/**
* Diagnostic severity.
*
Expand Down Expand Up @@ -854,7 +846,47 @@ thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,
extern void thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,
unsigned max_size_files);


/** Opaque reference to an LTO input file */
typedef struct LLVMOpaqueLTOInput *lto_input_t;

/**
* Creates an LTO input file from a buffer. The path
* argument is used for diagnotics as this function
* otherwise does not know which file the given buffer
* is associated with.
*
* \since LTO_API_VERSION=24
*/
extern lto_input_t lto_input_create(const void *buffer,
size_t buffer_size,
const char *path);

/**
* Frees all memory internally allocated by the LTO input file.
* Upon return the lto_module_t is no longer valid.
*
* \since LTO_API_VERSION=24
*/
extern void lto_input_dispose(lto_input_t input);

/**
* Returns the number of dependent library specifiers
* for the given LTO input file.
*
* \since LTO_API_VERSION=24
*/
extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input);

/**
* Returns the ith dependent library specifier
* for the given LTO input file. The returned
* string is not null-terminated.
*
* \since LTO_API_VERSION=24
*/
extern const char * lto_input_get_dependent_library(lto_input_t input,
size_t index,
size_t *size);

/**
* @} // endgroup LLVMCTLTO_CACHING
Expand Down
6 changes: 6 additions & 0 deletions include/llvm/Analysis/LoopAccessAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,11 @@ class LoopAccessInfo {
/// no memory dependence cycles.
bool canVectorizeMemory() const { return CanVecMem; }

/// Return true if there is a convergent operation in the loop. There may
/// still be reported runtime pointer checks that would be required, but it is
/// not legal to insert them.
bool hasConvergentOp() const { return HasConvergentOp; }

const RuntimePointerChecking *getRuntimePointerChecking() const {
return PtrRtChecking.get();
}
Expand Down Expand Up @@ -642,6 +647,7 @@ class LoopAccessInfo {

/// Cache the result of analyzeLoop.
bool CanVecMem;
bool HasConvergentOp;

/// Indicator that there are non vectorizable stores to a uniform address.
bool HasDependenceInvolvingLoopInvariantAddress;
Expand Down
2 changes: 1 addition & 1 deletion include/llvm/Analysis/ScalarEvolutionExpander.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ namespace llvm {
/// avoid inserting an obviously redundant operation, and hoisting to an
/// outer loop when the opportunity is there and it is safe.
Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, Value *RHS,
bool IsSafeToHoist);
SCEV::NoWrapFlags Flags, bool IsSafeToHoist);

/// Arrange for there to be a cast of V to Ty at IP, reusing an existing
/// cast if a suitable one exists, moving an existing cast if a suitable one
Expand Down
Loading

0 comments on commit 595b180

Please sign in to comment.