[llvm] r343505 - MIRParser: Check that instructions only reference DILocation metadata
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 1 10:50:52 PDT 2018
Author: matze
Date: Mon Oct 1 10:50:52 2018
New Revision: 343505
URL: http://llvm.org/viewvc/llvm-project?rev=343505&view=rev
Log:
MIRParser: Check that instructions only reference DILocation metadata
Added:
llvm/trunk/test/CodeGen/MIR/X86/invalid-debug-location.mir
Modified:
llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
Modified: llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp?rev=343505&r1=343504&r2=343505&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp (original)
+++ llvm/trunk/lib/CodeGen/MIRParser/MIParser.cpp Mon Oct 1 10:50:52 2018
@@ -779,6 +779,8 @@ bool MIParser::parse(MachineInstr *&MI)
MDNode *Node = nullptr;
if (parseMDNode(Node))
return true;
+ if (!isa<DILocation>(Node))
+ return error("referenced metadata is not a DILocation");
DebugLocation = DebugLoc(Node);
}
Added: llvm/trunk/test/CodeGen/MIR/X86/invalid-debug-location.mir
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/MIR/X86/invalid-debug-location.mir?rev=343505&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/MIR/X86/invalid-debug-location.mir (added)
+++ llvm/trunk/test/CodeGen/MIR/X86/invalid-debug-location.mir Mon Oct 1 10:50:52 2018
@@ -0,0 +1,15 @@
+# RUN: not llc -o - %s -run-pass=none 2>&1 | FileCheck %s
+--- |
+ target triple="x86_64--"
+ define void @func() {
+ unreachable
+ }
+ !0 = !{}
+...
+---
+name: func
+body: |
+ bb.0:
+ ; CHECK: [[@LINE+1]]:27: referenced metadata is not a DILocation
+ NOOP debug-location !0
+...
More information about the llvm-commits
mailing list