199bd3cbaSJuergen Ributzka; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=corei7 | FileCheck %s 2f49bc3f1SLang Hames 33c0af352SPete Cooper; Check that the X86 stackmap shadow optimization is only outputting a 3-byte 43c0af352SPete Cooper; nop here. 8-bytes are requested, but 5 are covered by the code for the call to 53c0af352SPete Cooper; bar. However, the frame teardown and the return do not count towards the 63c0af352SPete Cooper; stackmap shadow as the call return counts as a branch target so must flush 73c0af352SPete Cooper; the shadow. 87c801dc9SPete Cooper; Note that in order for a thread to not return in to the patched space 97c801dc9SPete Cooper; the call must be at the end of the shadow, so the required nop must be 107c801dc9SPete Cooper; before the call, not after. 11f49bc3f1SLang Hamesdefine void @shadow_optimization_test() { 12f49bc3f1SLang Hamesentry: 13f49bc3f1SLang Hames; CHECK-LABEL: shadow_optimization_test: 14f49bc3f1SLang Hames; CHECK: callq _bar 157c801dc9SPete Cooper; CHECK: nop 167c801dc9SPete Cooper; CHECK: callq _bar 17f49bc3f1SLang Hames; CHECK-NOT: nop 18f49bc3f1SLang Hames; CHECK: callq _bar 197c801dc9SPete Cooper; CHECK-NOT: nop 20f49bc3f1SLang Hames call void @bar() 21*23af6484SDavid Blaikie tail call void (i64, i32, ...) @llvm.experimental.stackmap(i64 0, i32 8) 22f49bc3f1SLang Hames call void @bar() 237c801dc9SPete Cooper call void @bar() 24f49bc3f1SLang Hames ret void 25f49bc3f1SLang Hames} 26f49bc3f1SLang Hames 27f49bc3f1SLang Hamesdeclare void @llvm.experimental.stackmap(i64, i32, ...) 28f49bc3f1SLang Hamesdeclare void @bar() 29