[llvm] 9c244a3 - [InstSimplify] Add test for load of aggregate (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 10 07:18:33 PST 2021


Author: Nikita Popov
Date: 2021-12-10T16:18:18+01:00
New Revision: 9c244a33e7046e98fb739902808e7dc78298f516

URL: https://github.com/llvm/llvm-project/commit/9c244a33e7046e98fb739902808e7dc78298f516
DIFF: https://github.com/llvm/llvm-project/commit/9c244a33e7046e98fb739902808e7dc78298f516.diff

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

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/ConstProp/loads.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
index b7a1f6c78456f..adde18135a964 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
+}


        


More information about the llvm-commits mailing list