[llvm] 3be4acb - [InstSimplify] Add additional load from constant test (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 3 06:52:45 PDT 2021


Author: Nikita Popov
Date: 2021-10-03T15:52:36+02:00
New Revision: 3be4acbaa35607131411e94829185227a061e639

URL: https://github.com/llvm/llvm-project/commit/3be4acbaa35607131411e94829185227a061e639
DIFF: https://github.com/llvm/llvm-project/commit/3be4acbaa35607131411e94829185227a061e639.diff

LOG: [InstSimplify] Add additional load from constant test (NFC)

This case does not get folded, because the GEP indexes too deeply
(to the i8), making the bitcast logic not apply (on the [8 x i8]).

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 6f25b9f8d10c..c5ada729b31a 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
@@ -261,3 +261,14 @@ define i32* @test_undef_aggregate() {
   %v = load i32*, i32** bitcast ({i128}* @g10 to i32**)
   ret i32* %v
 }
+
+ at g11 = constant <{ [8 x i8], [8 x i8] }> <{ [8 x i8] undef, [8 x i8] zeroinitializer }>, align 4
+
+define {}* @test_trailing_zero_gep_index() {
+; CHECK-LABEL: @test_trailing_zero_gep_index(
+; CHECK-NEXT:    [[V:%.*]] = load {}*, {}** bitcast (i8* getelementptr inbounds (<{ [8 x i8], [8 x i8] }>, <{ [8 x i8], [8 x i8] }>* @g11, i64 0, i32 1, i64 0) to {}**), align 4
+; CHECK-NEXT:    ret {}* [[V]]
+;
+  %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
+}


        


More information about the llvm-commits mailing list