[PATCH] D149207: [llvm-exegesis] Create a proper LLVM IR Function for MachineFunctions

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 15:05:36 PDT 2023


aeubanks created this revision.
Herald added a subscriber: mstojanovic.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added subscribers: llvm-commits, courbet.
Herald added a project: LLVM.

I have upcoming changes break with invalid Function definitions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149207

Files:
  llvm/tools/llvm-exegesis/lib/Assembler.cpp


Index: llvm/tools/llvm-exegesis/lib/Assembler.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/Assembler.cpp
+++ llvm/tools/llvm-exegesis/lib/Assembler.cpp
@@ -21,6 +21,8 @@
 #include "llvm/CodeGen/TargetPassConfig.h"
 #include "llvm/CodeGen/TargetSubtargetInfo.h"
 #include "llvm/ExecutionEngine/SectionMemoryManager.h"
+#include "llvm/IR/BasicBlock.h"
+#include "llvm/IR/Instructions.h"
 #include "llvm/IR/LegacyPassManager.h"
 #include "llvm/MC/MCInstrInfo.h"
 #include "llvm/Support/Alignment.h"
@@ -84,6 +86,8 @@
   // Making sure we can create a MachineFunction out of this Function even if it
   // contains no IR.
   F->setIsMaterializable(true);
+  BasicBlock *BB = BasicBlock::Create(Module->getContext(), "", F);
+  new UnreachableInst(Module->getContext(), BB);
   return MMI->getOrCreateMachineFunction(*F);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149207.516951.patch
Type: text/x-patch
Size: 882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/dbc4d858/attachment.bin>


More information about the llvm-commits mailing list