Skip to content

Commit e30b2bf

Browse files
Skip DAE if the integration header is not specified
1 parent 5b0c754 commit e30b2bf

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -773,11 +773,6 @@ constexpr StringLiteral OMIT_TABLE_BEGIN("// OMIT_TABLE_BEGIN");
773773
constexpr StringLiteral OMIT_TABLE_END("// OMIT_TABLE_END");
774774
static void updateIntegrationHeader(StringRef SyclKernelName,
775775
const ArrayRef<bool> &ArgAlive) {
776-
// TODO: Enable asserts once the driver will provide the option.
777-
if (!IntegrationHeaderFileName.getNumOccurrences())
778-
return;
779-
// assert(IntegrationHeaderFileName.hasArgStr() &&
780-
// "Integration header file not specified!");
781776
ErrorOr<std::unique_ptr<MemoryBuffer>> IntHeaderBuffer =
782777
MemoryBuffer::getFile(IntegrationHeaderFileName);
783778

@@ -1196,6 +1191,11 @@ bool DeadArgumentEliminationPass::RemoveDeadStuffFromFunction(Function *F) {
11961191

11971192
PreservedAnalyses DeadArgumentEliminationPass::run(Module &M,
11981193
ModuleAnalysisManager &) {
1194+
// Integration header file must be provided for
1195+
// DAE to work on SPIR kernels.
1196+
if (CheckSyclKernels && !IntegrationHeaderFileName.getNumOccurrences())
1197+
return PreservedAnalyses::all();
1198+
11991199
bool Changed = false;
12001200

12011201
// First pass: Do a simple check to see if any functions can have their "..."

llvm/test/Transforms/DeadArgElim/sycl-kernels-neg1.ll

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
; TODO: this should be crashing (not --crash) after enabling assert
2-
; RUN: opt < %s -deadargelim-sycl -S
3-
4-
; Path to the integration header is not specified.
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --function-signature
2+
; RUN: opt < %s -deadargelim-sycl -S | FileCheck %s
3+
; Skip DAE if the path to the integration header is not specified.
54

65
target triple = "spir64-unknown-unknown-sycldevice"
76

87
define weak_odr spir_kernel void @NegativeSyclKernel(float %arg1, float %arg2) {
8+
; CHECK-LABEL: define {{[^@]+}}@NegativeSyclKernel
9+
; CHECK-SAME: (float [[ARG1:%.*]], float [[ARG2:%.*]])
10+
; CHECK-NEXT: call void @foo(float [[ARG1]])
11+
; CHECK-NEXT: ret void
12+
;
913
call void @foo(float %arg1)
1014
ret void
1115
}

0 commit comments

Comments
 (0)