From 1efa7d6849547f2525cd4766ca602253c9fc41d3 Mon Sep 17 00:00:00 2001
From: Simon Schuster <git@rationality.eu>
Date: Fri, 20 Apr 2018 15:49:08 +0200
Subject: [PATCH] Bugfix: Ignore CFI_INSTRUCTIONs in the PML-Export

---
 lib/Target/ARM/ARMExport.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/Target/ARM/ARMExport.cpp b/lib/Target/ARM/ARMExport.cpp
index 22a0e8870cf..020d097b0ff 100644
--- a/lib/Target/ARM/ARMExport.cpp
+++ b/lib/Target/ARM/ARMExport.cpp
@@ -48,7 +48,12 @@ namespace llvm {
       virtual bool doExportInstruction(const MachineInstr *Ins) {
         return Ins->getOpcode() != ARM::PSEUDO_LOOPBOUND
             && Ins->getOpcode() != ARM::IMPLICIT_DEF
-            && Ins->getOpcode() != ARM::PSEUDO_PLATINA;
+            && Ins->getOpcode() != ARM::PSEUDO_PLATINA
+            && Ins->getOpcode() != TargetOpcode::CFI_INSTRUCTION;
+            // As of 20.04.2018: For obscure reasons, the final
+            // RET instructions are Pseudo instructions. Therefore
+            // the following code is dangerous.
+            //    !(Ins->isPseudo() && !Ins->isInlineAsm())
       }
 
       virtual void serialize(MachineFunction &MF);
@@ -150,7 +155,6 @@ namespace llvm {
           IsBundled = false;
         }
 
-
         if (Ins->getOpcode() == ARM::PSEUDO_PLATINA) {
           assert(Ins->getNumOperands() == 2
               && "PSEUDO_PLATINA takes a type and an expression operand");
-- 
GitLab