[PATCH] D97066: [MC] Diagnose MCContext errors using LLVMContext handler
Yuanfang Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 19 10:28:52 PST 2021
ychen created this revision.
ychen added reviewers: MaskRay, rnk, tejohnson.
Herald added subscribers: kerbowa, hiraditya, nhaehnle, jvesely.
ychen requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This happens before we reset the MCContext so that errors are propagated
to users. Without this, some errors are silently ignored even with a
correct error message.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97066
Files:
llvm/lib/CodeGen/MachineModuleInfo.cpp
llvm/test/CodeGen/AMDGPU/lds-initializer.ll
llvm/test/CodeGen/AMDGPU/lds-zero-initializer.ll
llvm/test/CodeGen/XCore/section-name.ll
Index: llvm/test/CodeGen/XCore/section-name.ll
===================================================================
--- llvm/test/CodeGen/XCore/section-name.ll
+++ llvm/test/CodeGen/XCore/section-name.ll
@@ -1,4 +1,4 @@
-; RUN: llc < %s -march=xcore -o /dev/null 2>&1 | FileCheck %s
+; RUN: not llc < %s -march=xcore -o /dev/null 2>&1 | FileCheck %s
@bar = internal global i32 zeroinitializer
Index: llvm/test/CodeGen/AMDGPU/lds-zero-initializer.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/lds-zero-initializer.ll
+++ llvm/test/CodeGen/AMDGPU/lds-zero-initializer.ll
@@ -1,5 +1,5 @@
-; RUN: llc -march=amdgcn -mcpu=tahiti < %s -o /dev/null 2>&1 | FileCheck %s
-; RUN: llc -march=amdgcn -mcpu=tonga < %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: not llc -march=amdgcn -mcpu=tahiti < %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: not llc -march=amdgcn -mcpu=tonga < %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: lds: unsupported initializer for address space
Index: llvm/test/CodeGen/AMDGPU/lds-initializer.ll
===================================================================
--- llvm/test/CodeGen/AMDGPU/lds-initializer.ll
+++ llvm/test/CodeGen/AMDGPU/lds-initializer.ll
@@ -1,5 +1,5 @@
-; RUN: llc -march=amdgcn -mcpu=tahiti < %s -o /dev/null 2>&1 | FileCheck %s
-; RUN: llc -march=amdgcn -mcpu=tonga < %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: not llc -march=amdgcn -mcpu=tahiti < %s -o /dev/null 2>&1 | FileCheck %s
+; RUN: not llc -march=amdgcn -mcpu=tonga < %s -o /dev/null 2>&1 | FileCheck %s
; CHECK: lds: unsupported initializer for address space
Index: llvm/lib/CodeGen/MachineModuleInfo.cpp
===================================================================
--- llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -169,6 +169,9 @@
delete AddrLabelSymbols;
AddrLabelSymbols = nullptr;
+ if (Context.hadError())
+ TheModule->getContext().emitError("MC error");
+
Context.reset();
// We don't clear the ExternalContext.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97066.325031.patch
Type: text/x-patch
Size: 2050 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210219/da2a7af7/attachment.bin>
More information about the llvm-commits
mailing list