1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -O3 < %s | FileCheck %s
4 ; A miscompilation found on https://github.com/llvm/llvm-project/issues/64289.
5 ; 1. PostOrderFunctionAttrsPass added readonly to the parameter.
6 ; 2. TailCallElimPass modified the parameter but kept readonly.
7 ; 3. LICMPass incorrectly hoisted the load instruction.
9 define void @pr64289(ptr noalias byval(i64) %x) {
10 ; CHECK-LABEL: @pr64289(
12 ; CHECK-NEXT: ret void
15 %new_x = alloca i64, align 8
16 %x_val = load i64, ptr %x, align 8
17 %is_zero = icmp eq i64 %x_val, 0
18 br i1 %is_zero, label %end, label %recurse
21 store i64 0, ptr %new_x, align 8
22 call void @pr64289(ptr %new_x)