xref: /llvm-project/llvm/test/CodeGen/AArch64/fast-isel-erase.ll (revision 5ddce70ef0e5a641d7fea95e31fc5e2439cb98cb)
1; RUN: llc -mtriple=arm64-apple-ios -o - %s -fast-isel=1 -O0 | FileCheck %s
2
3; The zext can be folded into the load and removed, but doing so can invalidate
4; pointers internal to FastISel and cause a crash so it must be done carefully.
5define i32 @test() {
6; CHECK-LABEL: test:
7; CHECK: ldrh
8; CHECK: bl _callee
9; CHECK-NOT: uxth
10
11entry:
12  store i32 undef, ptr undef, align 4
13  %t81 = load i16, ptr undef, align 2
14  call void @callee()
15  %t82 = zext i16 %t81 to i32
16  %t83 = shl i32 %t82, 16
17  %t84 = or i32 undef, %t83
18  br label %end
19
20end:
21  %val = phi i32 [%t84, %entry]
22  ret i32 %val
23}
24
25declare void @callee()
26