Skip to content

Commit 94fbc4b

Browse files
authored
Merge pull request rust-lang#144 from nmdis1999/main
Fix handling of constants in FixStackmapSpillReloads pass.
2 parents 336d00a + 9bc2c3f commit 94fbc4b

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

llvm/lib/CodeGen/Yk/FixStackmapsSpillReloads.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ bool FixStackmapsSpillReloads::runOnMachineFunction(MachineFunction &MF) {
210210
MIB.add(*MOI); // Offset
211211
break;
212212
}
213-
case StackMaps::ConstantOp: {break;}
213+
case StackMaps::ConstantOp: {
214+
MOI++;
215+
MIB.add(*MOI);
216+
break;
217+
}
214218
case StackMaps::NextLive: {break;}
215219
}
216220
MOI++;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
; RUN: llc -stop-after fix-stackmaps-spill-reloads --yk-insert-stackmaps --yk-stackmap-spillreloads-fix < %s | FileCheck %s
2+
; CHECK: STACKMAP 1, 0, 0, $rbp, -8, 3, implicit-def dead early-clobber $r11
3+
@hash_search_j = dso_local global i64 0, align 8
4+
5+
; Function Attrs: noinline nounwind optnone uwtable
6+
define dso_local void @luaH_getint(i64 noundef %0) #0 {
7+
%2 = alloca i64, align 8
8+
store i64 %0, i64* %2, align 8
9+
ret void
10+
}
11+
12+
; Function Attrs: noinline nounwind optnone uwtable
13+
define dso_local i64 @hash_search() #0 {
14+
%1 = alloca i64, align 8
15+
%2 = load i64, i64* @hash_search_j, align 8
16+
%3 = icmp ne i64 %2, 0
17+
br i1 %3, label %4, label %5
18+
19+
4: ; preds = %0
20+
call void @luaH_getint(i64 noundef 9223372036854775807)
21+
store i64 9223372036854775807, i64* %1, align 8
22+
br label %6
23+
24+
5: ; preds = %0
25+
store i64 0, i64* %1, align 8
26+
br label %6
27+
28+
6: ; preds = %5, %4
29+
%7 = load i64, i64* %1, align 8
30+
ret i64 %7
31+
}
32+
33+
attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

0 commit comments

Comments
 (0)