Skip to content

Commit 595b180

Browse files
author
Jenkins
committed
SWDEV-179954 - OpenCL/LC - Merge branch amd-master into amd-common
Change-Id: I16c1d0cdf3f1d1129d5230f48282460b5904d1c2
2 parents 742a194 + 93a64c9 commit 595b180

File tree

138 files changed

+5139
-1003
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+5139
-1003
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ autoconf/autom4te.cache
4545
/CMakeSettings.json
4646
# CLion project configuration
4747
/.idea
48+
# Qt Creator project configuration
49+
/CMakeLists.txt.user
4850

4951
#==============================================================================#
5052
# Directories to ignore (do not add trailing '/'s, they skip symlinks).

bindings/go/llvm/dibuilder.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -305,11 +305,11 @@ func (d *DIBuilder) CreateBasicType(t DIBasicType) Metadata {
305305

306306
// DIPointerType holds the values for creating pointer type debug metadata.
307307
type DIPointerType struct {
308-
Pointee Metadata
309-
SizeInBits uint64
310-
AlignInBits uint32 // optional
308+
Pointee Metadata
309+
SizeInBits uint64
310+
AlignInBits uint32 // optional
311311
AddressSpace uint32
312-
Name string // optional
312+
Name string // optional
313313
}
314314

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

356356
// DIStructType holds the values for creating struct type debug metadata.
357357
type DIStructType struct {
358-
Name string
359-
File Metadata
360-
Line int
361-
SizeInBits uint64
362-
AlignInBits uint32
363-
Flags int
364-
DerivedFrom Metadata
365-
Elements []Metadata
358+
Name string
359+
File Metadata
360+
Line int
361+
SizeInBits uint64
362+
AlignInBits uint32
363+
Flags int
364+
DerivedFrom Metadata
365+
Elements []Metadata
366366
VTableHolder Metadata // optional
367367
UniqueID string
368368
}
@@ -581,7 +581,7 @@ func (d *DIBuilder) InsertValueAtEnd(v Value, diVarInfo, expr Metadata, l DebugL
581581
}
582582

583583
func (v Value) SetSubprogram(sp Metadata) {
584-
C.LLVMSetSubprogram(v.C, sp.C)
584+
C.LLVMSetSubprogram(v.C, sp.C)
585585
}
586586

587587
func boolToCInt(v bool) C.int {

bindings/go/llvm/ir.go

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -384,49 +384,49 @@ func AttributeKindID(name string) (id uint) {
384384
}
385385

386386
func (c Context) CreateEnumAttribute(kind uint, val uint64) (a Attribute) {
387-
a.C = C.LLVMCreateEnumAttribute(c.C, C.unsigned(kind), C.uint64_t(val))
388-
return
387+
a.C = C.LLVMCreateEnumAttribute(c.C, C.unsigned(kind), C.uint64_t(val))
388+
return
389389
}
390390

391391
func (a Attribute) GetEnumKind() (id int) {
392-
id = int(C.LLVMGetEnumAttributeKind(a.C))
393-
return
392+
id = int(C.LLVMGetEnumAttributeKind(a.C))
393+
return
394394
}
395395

396396
func (a Attribute) GetEnumValue() (val uint64) {
397-
val = uint64(C.LLVMGetEnumAttributeValue(a.C))
398-
return
397+
val = uint64(C.LLVMGetEnumAttributeValue(a.C))
398+
return
399399
}
400400

401401
func (c Context) CreateStringAttribute(kind string, val string) (a Attribute) {
402-
ckind := C.CString(kind)
403-
defer C.free(unsafe.Pointer(ckind))
404-
cval := C.CString(val)
405-
defer C.free(unsafe.Pointer(cval))
406-
a.C = C.LLVMCreateStringAttribute(c.C,
407-
ckind, C.unsigned(len(kind)),
408-
cval, C.unsigned(len(val)))
409-
return
402+
ckind := C.CString(kind)
403+
defer C.free(unsafe.Pointer(ckind))
404+
cval := C.CString(val)
405+
defer C.free(unsafe.Pointer(cval))
406+
a.C = C.LLVMCreateStringAttribute(c.C,
407+
ckind, C.unsigned(len(kind)),
408+
cval, C.unsigned(len(val)))
409+
return
410410
}
411411

412412
func (a Attribute) GetStringKind() string {
413-
length := C.unsigned(0)
414-
ckind := C.LLVMGetStringAttributeKind(a.C, &length)
415-
return C.GoStringN(ckind, C.int(length))
413+
length := C.unsigned(0)
414+
ckind := C.LLVMGetStringAttributeKind(a.C, &length)
415+
return C.GoStringN(ckind, C.int(length))
416416
}
417417

418418
func (a Attribute) GetStringValue() string {
419-
length := C.unsigned(0)
420-
ckind := C.LLVMGetStringAttributeValue(a.C, &length)
421-
return C.GoStringN(ckind, C.int(length))
419+
length := C.unsigned(0)
420+
ckind := C.LLVMGetStringAttributeValue(a.C, &length)
421+
return C.GoStringN(ckind, C.int(length))
422422
}
423423

424424
func (a Attribute) IsEnum() bool {
425-
return C.LLVMIsEnumAttribute(a.C) != 0;
425+
return C.LLVMIsEnumAttribute(a.C) != 0
426426
}
427427

428428
func (a Attribute) IsString() bool {
429-
return C.LLVMIsStringAttribute(a.C) != 0;
429+
return C.LLVMIsStringAttribute(a.C) != 0
430430
}
431431

432432
//-------------------------------------------------------------------------
@@ -1150,36 +1150,36 @@ func (v Value) SetGC(name string) {
11501150
C.LLVMSetGC(v.C, cname)
11511151
}
11521152
func (v Value) AddAttributeAtIndex(i int, a Attribute) {
1153-
C.LLVMAddAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), a.C)
1153+
C.LLVMAddAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), a.C)
11541154
}
11551155
func (v Value) AddFunctionAttr(a Attribute) {
1156-
v.AddAttributeAtIndex(C.LLVMAttributeFunctionIndex, a);
1156+
v.AddAttributeAtIndex(C.LLVMAttributeFunctionIndex, a)
11571157
}
11581158
func (v Value) GetEnumAttributeAtIndex(i int, kind uint) (a Attribute) {
1159-
a.C = C.LLVMGetEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
1160-
return
1159+
a.C = C.LLVMGetEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
1160+
return
11611161
}
11621162
func (v Value) GetEnumFunctionAttribute(kind uint) Attribute {
1163-
return v.GetEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
1163+
return v.GetEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
11641164
}
11651165
func (v Value) GetStringAttributeAtIndex(i int, kind string) (a Attribute) {
1166-
ckind := C.CString(kind)
1167-
defer C.free(unsafe.Pointer(ckind))
1168-
a.C = C.LLVMGetStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
1169-
ckind, C.unsigned(len(kind)))
1170-
return
1166+
ckind := C.CString(kind)
1167+
defer C.free(unsafe.Pointer(ckind))
1168+
a.C = C.LLVMGetStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
1169+
ckind, C.unsigned(len(kind)))
1170+
return
11711171
}
11721172
func (v Value) RemoveEnumAttributeAtIndex(i int, kind uint) {
1173-
C.LLVMRemoveEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
1173+
C.LLVMRemoveEnumAttributeAtIndex(v.C, C.LLVMAttributeIndex(i), C.unsigned(kind))
11741174
}
11751175
func (v Value) RemoveEnumFunctionAttribute(kind uint) {
1176-
v.RemoveEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind);
1176+
v.RemoveEnumAttributeAtIndex(C.LLVMAttributeFunctionIndex, kind)
11771177
}
11781178
func (v Value) RemoveStringAttributeAtIndex(i int, kind string) {
1179-
ckind := C.CString(kind)
1180-
defer C.free(unsafe.Pointer(ckind))
1181-
C.LLVMRemoveStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
1182-
ckind, C.unsigned(len(kind)))
1179+
ckind := C.CString(kind)
1180+
defer C.free(unsafe.Pointer(ckind))
1181+
C.LLVMRemoveStringAttributeAtIndex(v.C, C.LLVMAttributeIndex(i),
1182+
ckind, C.unsigned(len(kind)))
11831183
}
11841184
func (v Value) AddTargetDependentFunctionAttr(attr, value string) {
11851185
cattr := C.CString(attr)
@@ -1201,12 +1201,12 @@ func (v Value) Params() []Value {
12011201
}
12021202
return out
12031203
}
1204-
func (v Value) Param(i int) (rv Value) { rv.C = C.LLVMGetParam(v.C, C.unsigned(i)); return }
1205-
func (v Value) ParamParent() (rv Value) { rv.C = C.LLVMGetParamParent(v.C); return }
1206-
func (v Value) FirstParam() (rv Value) { rv.C = C.LLVMGetFirstParam(v.C); return }
1207-
func (v Value) LastParam() (rv Value) { rv.C = C.LLVMGetLastParam(v.C); return }
1208-
func NextParam(v Value) (rv Value) { rv.C = C.LLVMGetNextParam(v.C); return }
1209-
func PrevParam(v Value) (rv Value) { rv.C = C.LLVMGetPreviousParam(v.C); return }
1204+
func (v Value) Param(i int) (rv Value) { rv.C = C.LLVMGetParam(v.C, C.unsigned(i)); return }
1205+
func (v Value) ParamParent() (rv Value) { rv.C = C.LLVMGetParamParent(v.C); return }
1206+
func (v Value) FirstParam() (rv Value) { rv.C = C.LLVMGetFirstParam(v.C); return }
1207+
func (v Value) LastParam() (rv Value) { rv.C = C.LLVMGetLastParam(v.C); return }
1208+
func NextParam(v Value) (rv Value) { rv.C = C.LLVMGetNextParam(v.C); return }
1209+
func PrevParam(v Value) (rv Value) { rv.C = C.LLVMGetPreviousParam(v.C); return }
12101210
func (v Value) SetParamAlignment(align int) { C.LLVMSetParamAlignment(v.C, C.unsigned(align)) }
12111211

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

13521352
// Metadata
13531353
type DebugLoc struct {
1354-
Line, Col uint
1355-
Scope Metadata
1356-
InlinedAt Metadata
1354+
Line, Col uint
1355+
Scope Metadata
1356+
InlinedAt Metadata
13571357
}
1358+
13581359
func (b Builder) SetCurrentDebugLocation(line, col uint, scope, inlinedAt Metadata) {
13591360
C.LLVMGoSetCurrentDebugLocation(b.C, C.unsigned(line), C.unsigned(col), scope.C, inlinedAt.C)
13601361
}

bindings/go/llvm/transforms_coroutines.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package llvm
1717
*/
1818
import "C"
1919

20-
func (pm PassManager) AddCoroEarlyPass() { C.LLVMAddCoroEarlyPass(pm.C) }
21-
func (pm PassManager) AddCoroSplitPass() { C.LLVMAddCoroSplitPass(pm.C) }
22-
func (pm PassManager) AddCoroElidePass() { C.LLVMAddCoroElidePass(pm.C) }
23-
func (pm PassManager) AddCoroCleanupPass() { C.LLVMAddCoroCleanupPass(pm.C) }
20+
func (pm PassManager) AddCoroEarlyPass() { C.LLVMAddCoroEarlyPass(pm.C) }
21+
func (pm PassManager) AddCoroSplitPass() { C.LLVMAddCoroSplitPass(pm.C) }
22+
func (pm PassManager) AddCoroElidePass() { C.LLVMAddCoroElidePass(pm.C) }
23+
func (pm PassManager) AddCoroCleanupPass() { C.LLVMAddCoroCleanupPass(pm.C) }

docs/CommandGuide/llvm-nm.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ OPTIONS
121121

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

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

126126
.. option:: --size-sort
127127

@@ -134,7 +134,7 @@ OPTIONS
134134
.. option:: --radix=RADIX, -t
135135

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

139139
BUGS
140140
----

docs/CommandGuide/llvm-symbolizer.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ OPTIONS
102102
.. option:: -inlining, -inlines, -i
103103

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

107107
.. option:: -default-arch
108108

@@ -172,4 +172,5 @@ OPTIONS
172172
EXIT STATUS
173173
-----------
174174

175-
:program:`llvm-symbolizer` returns 0. Other exit codes imply internal program error.
175+
:program:`llvm-symbolizer` returns 0. Other exit codes imply an internal program
176+
error.

docs/GetElementPtr.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ therefore be indexed and requires an index operand. Consider this example:
7474
P[0].f1 = P[1].f1 + P[2].f2;
7575
}
7676
...
77-
munger_struct Array[3];
77+
struct munger_struct Array[3];
7878
...
7979
munge(Array);
8080
@@ -88,15 +88,15 @@ looks like:
8888

8989
.. code-block:: llvm
9090
91-
void %munge(%struct.munger_struct* %P) {
91+
define void @munge(%struct.munger_struct* %P) {
9292
entry:
9393
%tmp = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 1, i32 0
94-
%tmp = load i32* %tmp
95-
%tmp6 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
96-
%tmp7 = load i32* %tmp6
97-
%tmp8 = add i32 %tmp7, %tmp
98-
%tmp9 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
99-
store i32 %tmp8, i32* %tmp9
94+
%tmp1 = load i32, i32* %tmp
95+
%tmp2 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 2, i32 1
96+
%tmp3 = load i32, i32* %tmp2
97+
%tmp4 = add i32 %tmp3, %tmp1
98+
%tmp5 = getelementptr %struct.munger_struct, %struct.munger_struct* %P, i32 0, i32 0
99+
store i32 %tmp4, i32* %tmp5
100100
ret void
101101
}
102102
@@ -199,7 +199,7 @@ following:
199199
.. code-block:: text
200200
201201
%idx = getelementptr { [40 x i32]* }, { [40 x i32]* }* %, i64 0, i32 0
202-
%arr = load [40 x i32]** %idx
202+
%arr = load [40 x i32]*, [40 x i32]** %idx
203203
%idx = getelementptr [40 x i32], [40 x i32]* %arr, i64 0, i64 17
204204
205205
In this case, we have to load the pointer in the structure with a load

include/llvm-c/lto.h

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,14 +297,6 @@ lto_module_get_symbol_attribute(lto_module_t mod, unsigned int index);
297297
extern const char*
298298
lto_module_get_linkeropts(lto_module_t mod);
299299

300-
/**
301-
* Returns the module's dependent library specifiers.
302-
*
303-
* \since LTO_API_VERSION=24
304-
*/
305-
extern const char*
306-
lto_module_get_dependent_libraries(lto_module_t mod);
307-
308300
/**
309301
* Diagnostic severity.
310302
*
@@ -854,7 +846,47 @@ thinlto_codegen_set_cache_size_megabytes(thinlto_code_gen_t cg,
854846
extern void thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg,
855847
unsigned max_size_files);
856848

857-
849+
/** Opaque reference to an LTO input file */
850+
typedef struct LLVMOpaqueLTOInput *lto_input_t;
851+
852+
/**
853+
* Creates an LTO input file from a buffer. The path
854+
* argument is used for diagnotics as this function
855+
* otherwise does not know which file the given buffer
856+
* is associated with.
857+
*
858+
* \since LTO_API_VERSION=24
859+
*/
860+
extern lto_input_t lto_input_create(const void *buffer,
861+
size_t buffer_size,
862+
const char *path);
863+
864+
/**
865+
* Frees all memory internally allocated by the LTO input file.
866+
* Upon return the lto_module_t is no longer valid.
867+
*
868+
* \since LTO_API_VERSION=24
869+
*/
870+
extern void lto_input_dispose(lto_input_t input);
871+
872+
/**
873+
* Returns the number of dependent library specifiers
874+
* for the given LTO input file.
875+
*
876+
* \since LTO_API_VERSION=24
877+
*/
878+
extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input);
879+
880+
/**
881+
* Returns the ith dependent library specifier
882+
* for the given LTO input file. The returned
883+
* string is not null-terminated.
884+
*
885+
* \since LTO_API_VERSION=24
886+
*/
887+
extern const char * lto_input_get_dependent_library(lto_input_t input,
888+
size_t index,
889+
size_t *size);
858890

859891
/**
860892
* @} // endgroup LLVMCTLTO_CACHING

include/llvm/Analysis/LoopAccessAnalysis.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,11 @@ class LoopAccessInfo {
522522
/// no memory dependence cycles.
523523
bool canVectorizeMemory() const { return CanVecMem; }
524524

525+
/// Return true if there is a convergent operation in the loop. There may
526+
/// still be reported runtime pointer checks that would be required, but it is
527+
/// not legal to insert them.
528+
bool hasConvergentOp() const { return HasConvergentOp; }
529+
525530
const RuntimePointerChecking *getRuntimePointerChecking() const {
526531
return PtrRtChecking.get();
527532
}
@@ -642,6 +647,7 @@ class LoopAccessInfo {
642647

643648
/// Cache the result of analyzeLoop.
644649
bool CanVecMem;
650+
bool HasConvergentOp;
645651

646652
/// Indicator that there are non vectorizable stores to a uniform address.
647653
bool HasDependenceInvolvingLoopInvariantAddress;

include/llvm/Analysis/ScalarEvolutionExpander.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ namespace llvm {
318318
/// avoid inserting an obviously redundant operation, and hoisting to an
319319
/// outer loop when the opportunity is there and it is safe.
320320
Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS, Value *RHS,
321-
bool IsSafeToHoist);
321+
SCEV::NoWrapFlags Flags, bool IsSafeToHoist);
322322

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

0 commit comments

Comments
 (0)