[llvm] 4e62d21 - [ConstantFold] Add test for load of padding (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 5 03:47:58 PST 2022


Author: Nikita Popov
Date: 2022-01-05T12:47:49+01:00
New Revision: 4e62d210c43086136b6c95a3c1806afaf6b38651

URL: https://github.com/llvm/llvm-project/commit/4e62d210c43086136b6c95a3c1806afaf6b38651
DIFF: https://github.com/llvm/llvm-project/commit/4e62d210c43086136b6c95a3c1806afaf6b38651.diff

LOG: [ConstantFold] Add test for load of padding (NFC)

This currently load zero rather than undef.

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 49cde82f9301..4ba3b6dcfb9a 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
@@ -315,3 +315,13 @@ define i8 @load_neg_one_at_unknown_offset() {
   %v = load i8, i8* getelementptr (<4 x i8>, <4 x i8>* @g_neg_one_vec, i64 0, i64 ptrtoint (i64* @g_offset to i64))
   ret i8 %v
 }
+
+ at g_with_padding = constant { i32, [4 x i8] } { i32 0, [4 x i8] undef }
+
+define i32 @load_padding() {
+; CHECK-LABEL: @load_padding(
+; CHECK-NEXT:    ret i32 0
+;
+  %v = load i32, i32* getelementptr (i32, i32* bitcast ({ i32, [4 x i8] }* @g_with_padding to i32*), i64 1)
+  ret i32 %v
+}


        


More information about the llvm-commits mailing list