Fix i386 Calling llvm.experimental.patchpoint.i64

lin zuojian manjian2006 at gmail.com
Sun Jun 21 19:19:12 PDT 2015


Hi,
    I try to call llvm.experimental.patchpoint.i64 on i386 arch, and
    it crashes. I figure out this is because there are two CopyFromReg
    node instead of one on i386 arch. So I make a patch:
Index: test/CodeGen/X86/patchpoint-i386.ll
===================================================================
--- test/CodeGen/X86/patchpoint-i386.ll	(revision 0)
+++ test/CodeGen/X86/patchpoint-i386.ll	(working copy)
@@ -0,0 +1,8 @@
+; RUN: llc < %s -mtriple=i386-linux-gnu | FileCheck %s
+
+define fastcc i64 @main() {
+  %1 = call i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 1, i32 10, i8* null, i32 0)
+  ret i64 %1
+}
+
+declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)

Property changes on: test/CodeGen/X86/patchpoint-i386.ll
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp	(revision 240022)
+++ lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp	(working copy)
@@ -6591,7 +6591,7 @@
                       LandingPad, true);
 
   SDNode *CallEnd = Result.second.getNode();
-  if (HasDef && (CallEnd->getOpcode() == ISD::CopyFromReg))
+  while (HasDef && (CallEnd->getOpcode() == ISD::CopyFromReg))
     CallEnd = CallEnd->getOperand(0).getNode();
 
   /// Get a call instruction from the call sequence chain.


--
Lin Zuojian



More information about the llvm-commits mailing list