[PATCH] D54890: [MSP430] Fix crash while lowering llvm.stacksave/stackrestore

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 26 02:29:13 PST 2018


krisb created this revision.
krisb added a reviewer: asl.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D54890

Files:
  lib/Target/MSP430/MSP430ISelLowering.cpp
  test/CodeGen/MSP430/stacksave_restore.ll


Index: test/CodeGen/MSP430/stacksave_restore.ll
===================================================================
--- /dev/null
+++ test/CodeGen/MSP430/stacksave_restore.ll
@@ -0,0 +1,13 @@
+; RUN: llc < %s -march=msp430
+
+target triple = "msp430"
+
+define void @foo() #0 {
+entry:
+  %0 = tail call i8* @llvm.stacksave()
+  tail call void @llvm.stackrestore(i8* %0)
+  ret void
+}
+
+declare i8* @llvm.stacksave() #1
+declare void @llvm.stackrestore(i8*) #1
Index: lib/Target/MSP430/MSP430ISelLowering.cpp
===================================================================
--- lib/Target/MSP430/MSP430ISelLowering.cpp
+++ lib/Target/MSP430/MSP430ISelLowering.cpp
@@ -95,6 +95,8 @@
   setOperationAction(ISD::SIGN_EXTEND,      MVT::i16,   Custom);
   setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i8, Expand);
   setOperationAction(ISD::DYNAMIC_STACKALLOC, MVT::i16, Expand);
+  setOperationAction(ISD::STACKSAVE,        MVT::Other, Expand);
+  setOperationAction(ISD::STACKRESTORE,     MVT::Other, Expand);
 
   setOperationAction(ISD::CTTZ,             MVT::i8,    Expand);
   setOperationAction(ISD::CTTZ,             MVT::i16,   Expand);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54890.175215.patch
Type: text/x-patch
Size: 1150 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181126/40d9166b/attachment.bin>


More information about the llvm-commits mailing list