[llvm] 659871c - [ConstantFold] Add test for load of i8 from i1 (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 8 07:33:00 PDT 2022
Author: Nikita Popov
Date: 2022-04-08T16:32:51+02:00
New Revision: 659871cede9e3475c5de986ba4cace58e70f4801
URL: https://github.com/llvm/llvm-project/commit/659871cede9e3475c5de986ba4cace58e70f4801
DIFF: https://github.com/llvm/llvm-project/commit/659871cede9e3475c5de986ba4cace58e70f4801.diff
LOG: [ConstantFold] Add test for load of i8 from i1 (NFC)
Semantics here are a bit unclear, but the store-to-load forwarding
case at least should be a miscompile.
Added:
Modified:
llvm/test/Transforms/InstCombine/load-store-forward.ll
llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/load-store-forward.ll b/llvm/test/Transforms/InstCombine/load-store-forward.ll
index eee47e87a1ca3..618e67ed0c8ec 100644
--- a/llvm/test/Transforms/InstCombine/load-store-forward.ll
+++ b/llvm/test/Transforms/InstCombine/load-store-forward.ll
@@ -289,3 +289,25 @@ entry:
%2 = load <vscale x 4 x i8>, <vscale x 4 x i8>* %1, align 16
ret <vscale x 4 x i8> %2
}
+
+define i8 @load_i8_store_i1(i1* %a) {
+; CHECK-LABEL: @load_i8_store_i1(
+; CHECK-NEXT: store i1 true, i1* [[A:%.*]], align 1
+; CHECK-NEXT: ret i8 -1
+;
+ store i1 true, i1* %a
+ %a.i8 = bitcast i1* %a to i8*
+ %v = load i8, i8* %a.i8
+ ret i8 %v
+}
+
+define i1 @load_i1_store_i8(i8* %a) {
+; CHECK-LABEL: @load_i1_store_i8(
+; CHECK-NEXT: store i8 1, i8* [[A:%.*]], align 1
+; CHECK-NEXT: ret i1 true
+;
+ store i8 1, i8* %a
+ %a.i1 = bitcast i8* %a to i1*
+ %v = load i1, i1* %a.i1
+ ret i1 %v
+}
diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
index 58701bf5a63b5..586a431b81c9d 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
@@ -402,3 +402,13 @@ define i64 addrspace(2)* @load_non_integral_ptr_from_i8_data() {
%v = load i64 addrspace(2)*, i64 addrspace(2)** bitcast ([16 x i8]* @g_i8_data to i64 addrspace(2)**)
ret i64 addrspace(2)* %v
}
+
+ at g_i1 = constant i1 true
+
+define i8 @load_i8_from_i1() {
+; CHECK-LABEL: @load_i8_from_i1(
+; CHECK-NEXT: ret i8 -1
+;
+ %v = load i8, i8* bitcast (i1* @g_i1 to i8*)
+ ret i8 %v
+}
More information about the llvm-commits
mailing list