Skip to content

Commit

Permalink
[MSP430] Fix crash while lowering llvm.stacksave/stackrestore
Browse files Browse the repository at this point in the history
Perform the usual expansion of stacksave / restore intrinsics.
Patch by Kristina Bessonova!

Differential Revision: https://reviews.llvm.org/D54890

llvm-svn: 350710
  • Loading branch information
asl committed Jan 9, 2019
1 parent 7d497ea commit 9222ed4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions llvm/lib/Target/MSP430/MSP430ISelLowering.cpp
Expand Up @@ -95,6 +95,8 @@ MSP430TargetLowering::MSP430TargetLowering(const TargetMachine &TM,
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);
Expand Down
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/MSP430/stacksave_restore.ll
@@ -0,0 +1,13 @@
; RUN: llc < %s -march=msp430

target triple = "msp430"

define void @foo() {
entry:
%0 = tail call i8* @llvm.stacksave()
tail call void @llvm.stackrestore(i8* %0)
ret void
}

declare i8* @llvm.stacksave()
declare void @llvm.stackrestore(i8*)

0 comments on commit 9222ed4

Please sign in to comment.