[llvm] 8262f45 - [InstCombine] Add additional store forwarding test (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 21 11:47:58 PDT 2021
Author: Nikita Popov
Date: 2021-10-21T20:47:48+02:00
New Revision: 8262f45c73ae97de038e9b66ec5016938424123e
URL: https://github.com/llvm/llvm-project/commit/8262f45c73ae97de038e9b66ec5016938424123e
DIFF: https://github.com/llvm/llvm-project/commit/8262f45c73ae97de038e9b66ec5016938424123e.diff
LOG: [InstCombine] Add additional store forwarding test (NFC)
Variant where the load is larger than the store. Make sure we
don't forward this.
Added:
Modified:
llvm/test/Transforms/InstCombine/load-store-forward.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/load-store-forward.ll b/llvm/test/Transforms/InstCombine/load-store-forward.ll
index ab44a246dba4..3dac00c6280f 100644
--- a/llvm/test/Transforms/InstCombine/load-store-forward.ll
+++ b/llvm/test/Transforms/InstCombine/load-store-forward.ll
@@ -18,6 +18,20 @@ define i8 @load_smaller_int(i16* %p) {
ret i8 %load
}
+; This case can *not* be forwarded, as we only see part of the stored value.
+define i32 @load_larger_int(i16* %p) {
+; CHECK-LABEL: @load_larger_int(
+; CHECK-NEXT: store i16 258, i16* [[P:%.*]], align 2
+; CHECK-NEXT: [[P2:%.*]] = bitcast i16* [[P]] to i32*
+; CHECK-NEXT: [[LOAD:%.*]] = load i32, i32* [[P2]], align 4
+; CHECK-NEXT: ret i32 [[LOAD]]
+;
+ store i16 258, i16* %p
+ %p2 = bitcast i16* %p to i32*
+ %load = load i32, i32* %p2
+ ret i32 %load
+}
+
define i32 @vec_store_load_first(i32* %p) {
; CHECK-LABEL: @vec_store_load_first(
; CHECK-NEXT: [[P2:%.*]] = bitcast i32* [[P:%.*]] to <2 x i32>*
More information about the llvm-commits
mailing list