[llvm] 4b0c078 - [RISCV][test] Pre-commit test case where ConstantHoisting fails to trigger

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 06:49:56 PDT 2024


Author: Alex Bradbury
Date: 2024-06-19T14:49:10+01:00
New Revision: 4b0c078a13c614032236dacfa7331219d0c9ca23

URL: https://github.com/llvm/llvm-project/commit/4b0c078a13c614032236dacfa7331219d0c9ca23
DIFF: https://github.com/llvm/llvm-project/commit/4b0c078a13c614032236dacfa7331219d0c9ca23.diff

LOG: [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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/ConstantHoisting/RISCV/immediates.ll b/llvm/test/Transforms/ConstantHoisting/RISCV/immediates.ll
index 0a477d5b64847..8f57df6edb2c0 100644
--- a/llvm/test/Transforms/ConstantHoisting/RISCV/immediates.ll
+++ b/llvm/test/Transforms/ConstantHoisting/RISCV/immediates.ll
@@ -208,3 +208,15 @@ exit:
   store i32 10, ptr inttoptr (i32 2044 to ptr)
   ret void
 }
+
+; Check that we use a common base for immediates needed by a store if the
+; constants require more than 1 instruction.
+; TODO: This doesn't trigger currently.
+define void @test20(ptr %p1, ptr %p2) {
+; CHECK-LABEL: test20
+; CHECK: store i32 15111111, ptr %p1
+; CHECK: store i32 15111112, ptr %p2
+  store i32 15111111, ptr %p1, align 4
+  store i32 15111112, ptr %p2, align 4
+  ret void
+}


        


More information about the llvm-commits mailing list