Skip to content

Commit 4b0c078

Browse files
committed
[RISCV][test] Pre-commit test case where ConstantHoisting fails to trigger
Our getIntImmCostInst is falling back to returning TCC_Free in this case even though both immediates take two instructions to materialise.
1 parent c83d9e9 commit 4b0c078

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

llvm/test/Transforms/ConstantHoisting/RISCV/immediates.ll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,15 @@ exit:
208208
store i32 10, ptr inttoptr (i32 2044 to ptr)
209209
ret void
210210
}
211+
212+
; Check that we use a common base for immediates needed by a store if the
213+
; constants require more than 1 instruction.
214+
; TODO: This doesn't trigger currently.
215+
define void @test20(ptr %p1, ptr %p2) {
216+
; CHECK-LABEL: test20
217+
; CHECK: store i32 15111111, ptr %p1
218+
; CHECK: store i32 15111112, ptr %p2
219+
store i32 15111111, ptr %p1, align 4
220+
store i32 15111112, ptr %p2, align 4
221+
ret void
222+
}

0 commit comments

Comments
 (0)