brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.9 KiB · 35dda37 Raw
114 lines · plain
1; RUN: opt -passes="loop-mssa(simple-loop-unswitch)" -enable-nontrivial-unswitch -verify-memoryssa -S %s | FileCheck %s2; REQUIRES: asserts3 4target triple = "x86_64-unknown-linux-gnu"5 6declare void @foo()7 8; In Test1, there are no definitions. MemorySSA updates insert trivial phis and remove them.9; Verify all are removed, considering the SLU pass leaves unreachable blocks hanging when the MSSA updates are done.10; CHECK-LABEL: @Test111define void @Test1(i32) {12header:13  br label %outer14 15outer.loopexit.split:                             ; preds = %continue16  br label %outer.loopexit17 18outer.loopexit:                                   ; preds = %outer.loopexit.split.us, %outer.loopexit.split19  br label %outer20 21outer:                                            ; preds = %outer.loopexit, %header22  br i1 false, label %outer.split.us, label %outer.split23 24outer.split.us:                                   ; preds = %outer25  br label %inner.us26 27inner.us:                                         ; preds = %continue.us, %outer.split.us28  br label %overflow.us29 30overflow.us:                                      ; preds = %inner.us31  br label %continue.us32 33continue.us:                                      ; preds = %overflow.us34  br i1 true, label %outer.loopexit.split.us, label %inner.us35 36outer.loopexit.split.us:                          ; preds = %continue.us37  br label %outer.loopexit38 39outer.split:                                      ; preds = %outer40  br label %inner41 42inner:                                            ; preds = %continue, %outer.split43  br label %switchme44 45switchme:                                         ; preds = %inner46  switch i32 %0, label %continue [47    i32 88, label %go_out48    i32 99, label %case249  ]50 51case2:                                            ; preds = %switchme52  br label %continue53 54continue:                                         ; preds = %case2, %switchme55  br i1 true, label %outer.loopexit.split, label %inner56 57go_out:                                           ; preds = %switchme58  unreachable59}60 61; In Test2 there is a single def (call to foo). There are already Phis in place that are cloned when unswitching.62; Ensure MemorySSA remains correct. Due to SLU's pruned cloning, continue.us2 becomes unreachable, with an empty Phi that is later cleaned.63; CHECK-LABEL: @Test264define void @Test2(i32) {65header:66  br label %outer67 68outer.loopexit.split:                             ; preds = %continue69  br label %outer.loopexit70 71outer.loopexit:                                   ; preds = %outer.loopexit.split.us, %outer.loopexit.split72  br label %outer73 74outer:                                            ; preds = %outer.loopexit, %header75  br i1 false, label %outer.split.us, label %outer.split76 77outer.split.us:                                   ; preds = %outer78  br label %inner.us79 80inner.us:                                         ; preds = %continue.us, %outer.split.us81  br label %overflow.us82 83overflow.us:                                      ; preds = %inner.us84  br label %continue.us85 86continue.us:                                      ; preds = %overflow.us87  br i1 true, label %outer.loopexit.split.us, label %inner.us88 89outer.loopexit.split.us:                          ; preds = %continue.us90  br label %outer.loopexit91 92outer.split:                                      ; preds = %outer93  br label %inner94 95inner:                                            ; preds = %continue, %outer.split96  br label %switchme97 98switchme:                                         ; preds = %inner99  switch i32 %0, label %continue [100    i32 88, label %go_out101    i32 99, label %case2102  ]103 104case2:                                            ; preds = %switchme105  call void @foo()106  br label %continue107 108continue:                                         ; preds = %case2, %switchme109  br i1 true, label %outer.loopexit.split, label %inner110 111go_out:                                           ; preds = %switchme112  unreachable113}114