xref: /llvm-project/llvm/test/Transforms/NewGVN/pr31573.ll (revision 229640343e400394b315c6798c7c19e8a9bd188c)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt < %s -passes=newgvn -S | FileCheck %s
3
4target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
5
6define void @patatino(ptr %blah) {
7; CHECK-LABEL: @patatino(
8; CHECK-NEXT:  entry:
9; CHECK-NEXT:    br label [[WHILE_COND:%.*]]
10; CHECK:       while.cond:
11; CHECK-NEXT:    [[MEH:%.*]] = phi ptr [ [[BLAH:%.*]], [[ENTRY:%.*]] ], [ null, [[WHILE_BODY:%.*]] ]
12; CHECK-NEXT:    switch i32 undef, label [[WHILE_BODY]] [
13; CHECK-NEXT:      i32 666, label [[WHILE_END:%.*]]
14; CHECK-NEXT:    ]
15; CHECK:       while.body:
16; CHECK-NEXT:    br label [[WHILE_COND]]
17; CHECK:       while.end:
18; CHECK-NEXT:    store i8 0, ptr [[MEH]], align 1
19; CHECK-NEXT:    store i8 0, ptr [[BLAH]], align 1
20; CHECK-NEXT:    ret void
21;
22entry:
23  br label %while.cond
24
25while.cond:
26  %meh = phi ptr [ %blah, %entry ], [ null, %while.body ]
27  switch i32 undef, label %while.body [
28  i32 666, label %while.end
29  ]
30
31while.body:
32  br label %while.cond
33
34while.end:
35;; These two stores will initially be considered equivalent, but then proven not.
36;; the second store would previously end up deciding it's equivalent to a previous
37;; store, but it was really just finding an optimistic version of itself
38;; in the congruence class.
39  store i8 0, ptr %meh, align 1
40  store i8 0, ptr %blah, align 1
41  ret void
42}
43