forked from rust-lang/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Speed up deferred diagnostic emitter
Move function emitDeferredDiags from Sema to DeferredDiagsEmitter since it is only used by DeferredDiagsEmitter. Also skip visited functions to avoid exponential compile time. Differential Revision: https://reviews.llvm.org/D77028
- Loading branch information
Showing
5 changed files
with
181 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// RUN: not %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu \ | ||
// RUN: -emit-llvm -o - %s 2>&1 | FileCheck %s | ||
// RUN: not %clang_cc1 -std=c++11 -triple x86_64-unknown-linux-gnu \ | ||
// RUN: -fcuda-is-device -emit-llvm -o - %s 2>&1 \ | ||
// RUN: | FileCheck %s | ||
|
||
// Check no crash due to deferred diagnostics. | ||
|
||
#include "Inputs/cuda.h" | ||
|
||
// CHECK: error: invalid output constraint '=h' in asm | ||
// CHECK-NOT: core dump | ||
inline __host__ __device__ int foo() { | ||
short h; | ||
__asm__("dont care" : "=h"(h) : "f"(0.0), "d"(0.0), "h"(0), "r"(0), "l"(0)); | ||
return 0; | ||
} | ||
|
||
void host_fun() { | ||
foo(); | ||
} | ||
|
||
__global__ void kernel() { | ||
foo(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: not %clang_cc1 -fcxx-exceptions -fcuda-is-device -fsyntax-only \ | ||
// RUN: -ferror-limit 2 2>&1 %s | FileCheck %s | ||
|
||
#include "Inputs/cuda.h" | ||
|
||
// CHECK: cannot use 'throw' in __host__ __device__ function | ||
// CHECK: cannot use 'throw' in __host__ __device__ function | ||
// CHECK-NOT: cannot use 'throw' in __host__ __device__ function | ||
// CHECK: too many errors emitted, stopping now | ||
|
||
inline __host__ __device__ void hasInvalid() { | ||
throw NULL; | ||
} | ||
|
||
__global__ void use0() { | ||
hasInvalid(); | ||
hasInvalid(); | ||
hasInvalid(); | ||
hasInvalid(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// RUN: %clang_cc1 -fcxx-exceptions -fcuda-is-device -fsyntax-only -verify %s | ||
|
||
#include "Inputs/cuda.h" | ||
|
||
// Error, instantiated on device. | ||
inline __host__ __device__ void hasInvalid() { | ||
throw NULL; | ||
// expected-error@-1 2{{cannot use 'throw' in __host__ __device__ function}} | ||
} | ||
|
||
static __device__ void use0() { | ||
hasInvalid(); // expected-note {{called by 'use0'}} | ||
hasInvalid(); // expected-note {{called by 'use0'}} | ||
} | ||
|
||
// To avoid excessive diagnostic messages, deferred diagnostics are only | ||
// emitted the first time a function is called. | ||
static __device__ void use1() { | ||
use0(); // expected-note 2{{called by 'use1'}} | ||
use0(); | ||
} | ||
|
||
static __device__ void use2() { | ||
use1(); // expected-note 2{{called by 'use2'}} | ||
use1(); | ||
} | ||
|
||
static __device__ void use3() { | ||
use2(); // expected-note 2{{called by 'use3'}} | ||
use2(); | ||
} | ||
|
||
__global__ void use4() { | ||
use3(); // expected-note 2{{called by 'use4'}} | ||
use3(); | ||
} |