Skip to content

Commit 51c9c82

Browse files
[RISCV] Added test case for PR119527. NFC (#121816)
Co-authored-by: Luke Lau <[email protected]>
1 parent 611c96a commit 51c9c82

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

llvm/test/CodeGen/RISCV/add_sext_shl_constant.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,19 @@ define i64 @add_shl_moreOneUse_sh3add(i64 %x) {
320320
ret i64 %add
321321
}
322322

323+
;; Covers a case which previously crashed (pr119527)
324+
define i64 @add_shl_sext(i32 %1) {
325+
; RV64-LABEL: add_shl_sext:
326+
; RV64: # %bb.0:
327+
; RV64-NEXT: addi a1, a0, 3
328+
; RV64-NEXT: sllw a0, a1, a0
329+
; RV64-NEXT: ret
330+
%3 = add i32 %1, 3
331+
%4 = shl i32 %3, %1
332+
%5 = sext i32 %4 to i64
333+
ret i64 %5
334+
}
335+
323336
define i64 @add_shl_moreOneUse_sh4add(i64 %x) {
324337
; RV64-LABEL: add_shl_moreOneUse_sh4add:
325338
; RV64: # %bb.0:

0 commit comments

Comments
 (0)