[llvm] 50c3bf2 - [InstSimplify] Add additional GEP tests with undef bases.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 11 05:44:14 PST 2022


Author: Florian Hahn
Date: 2022-01-11T13:43:53Z
New Revision: 50c3bf234f8dfda90fb4a9bda945f45638839ca2

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

LOG: [InstSimplify] Add additional GEP tests with undef bases.

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/gep.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/gep.ll b/llvm/test/Transforms/InstSimplify/gep.ll
index 88dea412d131d..4814291ddd672 100644
--- a/llvm/test/Transforms/InstSimplify/gep.ll
+++ b/llvm/test/Transforms/InstSimplify/gep.ll
@@ -158,6 +158,22 @@ define i8* @test7(i8* %b, i8** %e) {
   ret i8* %gep
 }
 
+define i64* @undef_inbounds_var_idx(i64 %idx) {
+; CHECK-LABEL: @undef_inbounds_var_idx(
+; CHECK-NEXT:    ret i64* undef
+;
+  %el = getelementptr inbounds i64, i64* undef, i64 %idx
+  ret i64* %el
+}
+
+define i64* @undef_no_inbounds_var_idx(i64 %idx) {
+; CHECK-LABEL: @undef_no_inbounds_var_idx(
+; CHECK-NEXT:    ret i64* undef
+;
+  %el = getelementptr i64, i64* undef, i64 %idx
+  ret i64* %el
+}
+
 define <8 x i64*> @undef_vec1() {
 ; CHECK-LABEL: @undef_vec1(
 ; CHECK-NEXT:    ret <8 x i64*> undef
@@ -257,8 +273,6 @@ define <vscale x 2 x i64*> @ptr_idx_mix_scalar_scalable_vector() {
 
 ; Check ConstantExpr::getGetElementPtr() using ElementCount for size queries - end.
 
-; TODO: these should return poison
-
 define i8* @poison() {
 ; CHECK-LABEL: @poison(
 ; CHECK-NEXT:    ret i8* poison


        


More information about the llvm-commits mailing list