[PATCH] D81403: Work around GlobalISel limitation on Indirect Thunks.

Kristof Beyls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 10 07:37:40 PDT 2020


kristof.beyls updated this revision to Diff 269839.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81403/new/

https://reviews.llvm.org/D81403

Files:
  llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
  llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll


Index: llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll
===================================================================
--- llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll
+++ llvm/test/CodeGen/AArch64/speculation-hardening-sls.ll
@@ -1,6 +1,8 @@
 ; RUN: llc -mattr=harden-sls-retbr,harden-sls-blr -verify-machineinstrs -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,HARDEN,ISBDSB --dump-input-on-failure
 ; RUN: llc -mattr=harden-sls-retbr,harden-sls-blr -mattr=+sb -verify-machineinstrs -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,HARDEN,SB --dump-input-on-failure
 ; RUN: llc -verify-machineinstrs -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,NOHARDEN --dump-input-on-failure
+; RUN: llc -global-isel -global-isel-abort=0 -mattr=harden-sls-retbr,harden-sls-blr -verify-machineinstrs -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,HARDEN,ISBDSB --dump-input-on-failure
+; RUN: llc -global-isel -global-isel-abort=0 -mattr=harden-sls-retbr,harden-sls-blr -mattr=+sb -verify-machineinstrs -mtriple=aarch64-none-linux-gnu < %s | FileCheck %s --check-prefixes=CHECK,HARDEN,SB --dump-input-on-failure
 
 ; Function Attrs: norecurse nounwind readnone
 define dso_local i32 @double_return(i32 %a, i32 %b) {
Index: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -2492,8 +2492,13 @@
   MF->remove(EntryBB);
   MF->DeleteMachineBasicBlock(EntryBB);
 
-  assert(&MF->front() == &NewEntryBB &&
-         "New entry wasn't next in the list of basic block!");
+  if (&MF->front() != &NewEntryBB) {
+    OptimizationRemarkMissed R("gisel-irtranslator", "GISelFailure",
+                               F.getSubprogram(), &F.getEntryBlock());
+    R << "unable to lower CFG structure.";
+    reportTranslationError(*MF, *TPC, *ORE, R);
+    return false;
+  }
 
   // Initialize stack protector information.
   StackProtector &SP = getAnalysis<StackProtector>();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81403.269839.patch
Type: text/x-patch
Size: 2149 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200610/5010b58c/attachment.bin>


More information about the llvm-commits mailing list