Skip to content

Commit 6b04278

Browse files
arichardsonresistor
authored andcommitted
Add test for infinite combine fix in the previous commit
This was somewhat awkward to reduce since giving the --print-before-all IR to llc would optimize away the pattern that triggers the loop. Writing the test with -start-before=riscv-isel allowed me to reduce it with bugpoint and then manually remove all branches to get the minimal test from this comit
1 parent 1a815dd commit 6b04278

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 2
2+
; RUN: %riscv64_cheri_purecap_llc -start-before=riscv-isel < %s | FileCheck %s
3+
;; This is a reduced testcase for an infinite combine that was fixed by
4+
;; "[CodeGen] Don't create combine loops for PTRADD with opaque constants"
5+
;; (commit 511c1e0089b4112d4dfbc8b3b093c588aeedb8e9)
6+
7+
define ptr addrspace(200) @wwv_rf(ptr addrspace(200) %arg) addrspace(200) {
8+
; CHECK-LABEL: wwv_rf:
9+
; CHECK: # %bb.0: # %entry
10+
; CHECK-NEXT: lui a1, 1
11+
; CHECK-NEXT: addi a1, a1, -656
12+
; CHECK-NEXT: addi a1, a1, 112
13+
; CHECK-NEXT: cincoffset a0, a0, a1
14+
; CHECK-NEXT: cret
15+
entry:
16+
; We need an opaque constant here to trigger the infinite loop that keeps
17+
; changing between (ptradd arg, (add 122, opaque 3440)) and
18+
; (ptradd (ptradd arg, 122), opaque 3440). Without the opaque constant,
19+
; the addition would just be folded to 3522.
20+
%const5 = bitcast i64 3440 to i64
21+
%const_mat = add i64 %const5, 112
22+
%scevgep2 = getelementptr i8, ptr addrspace(200) %arg, i64 %const_mat
23+
ret ptr addrspace(200) %scevgep2
24+
}

0 commit comments

Comments
 (0)