[PATCH] D75644: Test that volatile load type isn't changed
JF Bastien via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 4 16:53:34 PST 2020
jfb updated this revision to Diff 248356.
jfb added a comment.
Add i64/double test, as well as ptr/int
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75644/new/
https://reviews.llvm.org/D75644
Files:
llvm/test/Transforms/InstCombine/volatile_load_cast.ll
Index: llvm/test/Transforms/InstCombine/volatile_load_cast.ll
===================================================================
--- llvm/test/Transforms/InstCombine/volatile_load_cast.ll
+++ llvm/test/Transforms/InstCombine/volatile_load_cast.ll
@@ -1,21 +1,53 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
+target datalayout = "e-p:64:64-i32:32:32-i64:64:64-f32:32:32-f64:64:64"
+
define float @float_load(i32* %addr) {
; CHECK-LABEL: @float_load(
-; CHECK: %int = load volatile i32, i32* %addr, align 4
-; CHECK-NEXT: %float = bitcast i32 %int to float
+; CHECK: %i32 = load volatile i32, i32* %addr, align 4
+; CHECK-NEXT: %float = bitcast i32 %i32 to float
; CHECK-NEXT: ret float %float
- %int = load volatile i32, i32* %addr, align 4
- %float = bitcast i32 %int to float
+ %i32 = load volatile i32, i32* %addr, align 4
+ %float = bitcast i32 %i32 to float
ret float %float
}
-define i32 @int_load(float* %addr) {
-; CHECK-LABEL: @int_load(
+define i32 @i32_load(float* %addr) {
+; CHECK-LABEL: @i32_load(
; CHECK: %float = load volatile float, float* %addr, align 4
-; CHECK-NEXT: %int = bitcast float %float to i32
-; CHECK-NEXT: ret i32 %int
+; CHECK-NEXT: %i32 = bitcast float %float to i32
+; CHECK-NEXT: ret i32 %i32
%float = load volatile float, float* %addr, align 4
- %int = bitcast float %float to i32
- ret i32 %int
+ %i32 = bitcast float %float to i32
+ ret i32 %i32
+}
+
+define double @double_load(i64* %addr) {
+; CHECK-LABEL: @double_load(
+; CHECK: %i64 = load volatile i64, i64* %addr, align 8
+; CHECK-NEXT: %double = bitcast i64 %i64 to double
+; CHECK-NEXT: ret double %double
+ %i64 = load volatile i64, i64* %addr, align 8
+ %double = bitcast i64 %i64 to double
+ ret double %double
+}
+
+define i64 @i64_load(double* %addr) {
+; CHECK-LABEL: @i64_load(
+; CHECK: %double = load volatile double, double* %addr, align 8
+; CHECK-NEXT: %i64 = bitcast double %double to i64
+; CHECK-NEXT: ret i64 %i64
+ %double = load volatile double, double* %addr, align 8
+ %i64 = bitcast double %double to i64
+ ret i64 %i64
+}
+
+define i8* @ptr_load(i64* %addr) {
+; CHECK-LABEL: @ptr_load(
+; CHECK: %i64 = load volatile i64, i64* %addr, align 8
+; CHECK-NEXT: %ptr = inttoptr i64 %i64 to i8*
+; CHECK-NEXT: ret i8* %ptr
+ %i64 = load volatile i64, i64* %addr, align 8
+ %ptr = inttoptr i64 %i64 to i8*
+ ret i8* %ptr
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75644.248356.patch
Type: text/x-patch
Size: 2463 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200305/a3caabe0/attachment.bin>
More information about the llvm-commits
mailing list