[llvm] r263627 - AMDGPU: Verify instructions in non-debug builds as well
Michel Danzer via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 16 02:10:42 PDT 2016
Author: daenzer
Date: Wed Mar 16 04:10:42 2016
New Revision: 263627
URL: http://llvm.org/viewvc/llvm-project?rev=263627&view=rev
Log:
AMDGPU: Verify instructions in non-debug builds as well
And emit an error if it fails.
This prevents illegal instructions from getting sent to the GPU, which
would potentially result in a hang.
This is a candidate for the stable branch(es).
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Modified:
llvm/trunk/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp
Modified: llvm/trunk/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp?rev=263627&r1=263626&r2=263627&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp (original)
+++ llvm/trunk/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp Wed Mar 16 04:10:42 2016
@@ -88,13 +88,13 @@ void AMDGPUAsmPrinter::EmitInstruction(c
const AMDGPUSubtarget &STI = MF->getSubtarget<AMDGPUSubtarget>();
AMDGPUMCInstLower MCInstLowering(OutContext, STI);
-#ifdef _DEBUG
StringRef Err;
if (!STI.getInstrInfo()->verifyInstruction(MI, Err)) {
- errs() << "Warning: Illegal instruction detected: " << Err << "\n";
+ LLVMContext &C = MI->getParent()->getParent()->getFunction()->getContext();
+ C.emitError("Illegal instruction detected: " + Err);
MI->dump();
}
-#endif
+
if (MI->isBundle()) {
const MachineBasicBlock *MBB = MI->getParent();
MachineBasicBlock::const_instr_iterator I = ++MI->getIterator();
More information about the llvm-commits
mailing list