aboutsummaryrefslogtreecommitdiff
path: root/llvm
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-04-12 17:25:28 +0200
committerNikita Popov <npopov@redhat.com>2022-04-12 17:32:25 +0200
commitbc6d7ed8a9b9501d5d977a0825629791ee802fd6 (patch)
treec5dc722087f37fafb7ce91be0c457138c5284ebb /llvm
parent3870b3602552d118717800a71e08b7209ea65996 (diff)
downloadllvm-bc6d7ed8a9b9501d5d977a0825629791ee802fd6.zip
llvm-bc6d7ed8a9b9501d5d977a0825629791ee802fd6.tar.gz
llvm-bc6d7ed8a9b9501d5d977a0825629791ee802fd6.tar.bz2
[InstSimplify] Add test for PR49839 (NFC)
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/Transforms/InstSimplify/phi.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstSimplify/phi.ll b/llvm/test/Transforms/InstSimplify/phi.ll
index f1cdd8b..5d2ef05 100644
--- a/llvm/test/Transforms/InstSimplify/phi.ll
+++ b/llvm/test/Transforms/InstSimplify/phi.ll
@@ -152,3 +152,45 @@ EXIT:
%r = phi i8 [poison, %A], [poison, %B]
ret i8 %r
}
+
+@g = extern_weak global i32
+
+define i64 @pr49839_with_poison(i1 %c) {
+; CHECK-LABEL: @pr49839_with_poison(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[JOIN:%.*]]
+; CHECK: if:
+; CHECK-NEXT: br label [[JOIN]]
+; CHECK: join:
+; CHECK-NEXT: ret i64 srem (i64 1, i64 ptrtoint (i32* @g to i64))
+;
+entry:
+ br i1 %c, label %if, label %join
+
+if:
+ br label %join
+
+join:
+ %phi = phi i64 [ poison, %if ], [ srem (i64 1, i64 ptrtoint (i32* @g to i64)) , %entry ]
+ ret i64 %phi
+}
+
+define i64 @pr49839_without_poison(i1 %c) {
+; CHECK-LABEL: @pr49839_without_poison(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br i1 [[C:%.*]], label [[IF:%.*]], label [[JOIN:%.*]]
+; CHECK: if:
+; CHECK-NEXT: br label [[JOIN]]
+; CHECK: join:
+; CHECK-NEXT: ret i64 srem (i64 1, i64 ptrtoint (i32* @g to i64))
+;
+entry:
+ br i1 %c, label %if, label %join
+
+if:
+ br label %join
+
+join:
+ %phi = phi i64 [ srem (i64 1, i64 ptrtoint (i32* @g to i64)), %if ], [ srem (i64 1, i64 ptrtoint (i32* @g to i64)) , %entry ]
+ ret i64 %phi
+}