[PATCH] D35979: [X86] Fix a crash in FEntryInserter Pass.

Manoj Gupta via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 1 08:40:39 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL309694: [X86] Fix a crash in FEntryInserter Pass. (authored by manojgupta).

Repository:
  rL LLVM

https://reviews.llvm.org/D35979

Files:
  llvm/trunk/lib/CodeGen/FEntryInserter.cpp
  llvm/trunk/test/CodeGen/X86/fentry-insertion.ll


Index: llvm/trunk/lib/CodeGen/FEntryInserter.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/FEntryInserter.cpp
+++ llvm/trunk/lib/CodeGen/FEntryInserter.cpp
@@ -41,10 +41,8 @@
     return false;
 
   auto &FirstMBB = *MF.begin();
-  auto &FirstMI = *FirstMBB.begin();
-
   auto *TII = MF.getSubtarget().getInstrInfo();
-  BuildMI(FirstMBB, FirstMI, FirstMI.getDebugLoc(),
+  BuildMI(FirstMBB, FirstMBB.begin(), DebugLoc(),
           TII->get(TargetOpcode::FENTRY_CALL));
   return true;
 }
Index: llvm/trunk/test/CodeGen/X86/fentry-insertion.ll
===================================================================
--- llvm/trunk/test/CodeGen/X86/fentry-insertion.ll
+++ llvm/trunk/test/CodeGen/X86/fentry-insertion.ll
@@ -12,5 +12,19 @@
 ; CHECK: retq
 }
 
-attributes #0 = { "fentry-call"="true" }
+define void @test2() #1 {
+entry:
+  br label %bb1
+bb1:
+  call void @address_taken(i64 ptrtoint (i8* blockaddress(@test2, %bb1) to i64), i32 512)
+  ret void
 
+; CHECK-LABEL: @test2
+; CHECK: callq __fentry__
+; CHECK-NOT: mcount
+; CHECK: retq
+}
+
+declare void @address_taken(i64, i32) local_unnamed_addr
+attributes #0 = { "fentry-call"="true" }
+attributes #1 = { inlinehint minsize noredzone nounwind optsize sspstrong "fentry-call"="true" }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35979.109132.patch
Type: text/x-patch
Size: 1303 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170801/1f95303b/attachment.bin>


More information about the llvm-commits mailing list