From 9c244a33e7046e98fb739902808e7dc78298f516 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 10 Dec 2021 16:11:32 +0100 Subject: [PATCH] [InstSimplify] Add test for load of aggregate (NFC) The test is switched to use -instsimplify as it is in the InstSimplify directory. In this particular case InstCombine does fold the load (in a very roundabout way), but InstSimplify does not. --- .../test/Transforms/InstSimplify/ConstProp/loads.ll | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll index b7a1f6c78456..adde18135a96 100644 --- a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll +++ b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll @@ -1,6 +1,6 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py -; RUN: opt < %s -data-layout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64" -instcombine -S | FileCheck %s --check-prefixes=CHECK,LE -; RUN: opt < %s -data-layout="E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64" -instcombine -S | FileCheck %s --check-prefixes=CHECK,BE +; RUN: opt < %s -data-layout="e-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64" -instsimplify -S | FileCheck %s --check-prefixes=CHECK,LE +; RUN: opt < %s -data-layout="E-p:64:64:64-p1:16:16:16-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64" -instsimplify -S | FileCheck %s --check-prefixes=CHECK,BE ; {{ 0xDEADBEEF, 0xBA }, 0xCAFEBABE} @g1 = constant {{i32,i8},i32} {{i32,i8} { i32 -559038737, i8 186 }, i32 -889275714 } @@ -272,3 +272,12 @@ define {}* @test_trailing_zero_gep_index() { %v = load {}*, {}** bitcast (i8* getelementptr inbounds (<{ [8 x i8], [8 x i8] }>, <{ [8 x i8], [8 x i8] }>* @g11, i32 0, i32 1, i32 0) to {}**), align 4 ret {}* %v } + +define { i64, i64 } @test_load_struct() { +; CHECK-LABEL: @test_load_struct( +; CHECK-NEXT: [[V:%.*]] = load { i64, i64 }, { i64, i64 }* @g3, align 8 +; CHECK-NEXT: ret { i64, i64 } [[V]] +; + %v = load { i64, i64 }, { i64, i64 }* @g3 + ret { i64, i64 } %v +}