[llvm] e7ce6ac - [InstSimplify] Add test for load from undef (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 01:23:44 PST 2022


Author: Nikita Popov
Date: 2022-01-14T10:18:02+01:00
New Revision: e7ce6acc83e1e6b415a120efce9d2fb1615697a9

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

LOG: [InstSimplify] Add test for load from undef (NFC)

If we're loading from an all-undef value, we sometimes still
return 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 ddb95868f531e..08605d9b6460f 100644
--- a/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
+++ b/llvm/test/Transforms/InstSimplify/ConstProp/loads.ll
@@ -325,3 +325,14 @@ define i32 @load_padding() {
   %v = load i32, i32* getelementptr (i32, i32* bitcast ({ i32, [4 x i8] }* @g_with_padding to i32*), i64 1)
   ret i32 %v
 }
+
+ at g_all_undef = constant { i32, [4 x i8] } undef
+
+; Same as the previous case, but with an all-undef initializer.
+define i32 @load_all_undef() {
+; CHECK-LABEL: @load_all_undef(
+; CHECK-NEXT:    ret i32 0
+;
+  %v = load i32, i32* getelementptr (i32, i32* bitcast ({ i32, [4 x i8] }* @g_all_undef to i32*), i64 1)
+  ret i32 %v
+}


        


More information about the llvm-commits mailing list