brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.2 KiB · 31c3430 Raw
112 lines · plain
1; RUN: opt < %s -disable-output -passes='jump-threading,print<domtree>' 2>&1 | FileCheck %s2 3; REQUIRES: asserts4 5; The idea behind this test case is to verify that the dominator tree is6; updated in a deterministic way. Optimizations, at least EarlyCSE, are7; iterating the vectors that hold child nodes in the DominatorTree. Thus, the8; end result might differ depending on the order in which nodes are inserted9; in the dominator tree. Unfortunately this test case is quite large, but it10; happened to trigger a non-determinism quite often when being executed11; multipe times (it was possible to see varying results when running the test12; less that 10 times in a row).13; The actual problem was tracked down to llvm::MergeBasicBlockIntoOnlyPred, so14; the important property of the test is probably that it triggers a call to15; that function, and that the PredsOfPredBB set that is used to populate16; Updates for the DomTreeUpdater is populated with more than one entry.17 18; CHECK:      Inorder Dominator Tree: DFSNumbers invalid: 0 slow queries.19; CHECK-NEXT:   [1] %entry {4294967295,4294967295} [0]20; CHECK-NEXT:     [2] %for.cond1 {4294967295,4294967295} [1]21; CHECK-NEXT:       [3] %for.inc19 {4294967295,4294967295} [2]22; CHECK-NEXT:       [3] %if.then {4294967295,4294967295} [2]23; CHECK-NEXT:         [4] %for.cond5.preheader {4294967295,4294967295} [3]24; CHECK-NEXT:           [5] %cleanup {4294967295,4294967295} [4]25; CHECK-NEXT:             [6] %cleanup16 {4294967295,4294967295} [5]26; CHECK-NEXT:               [7] %unreachable {4294967295,4294967295} [6]27; CHECK-NEXT:               [7] %for.end21 {4294967295,4294967295} [6]28; CHECK-NEXT:           [5] %for.body7 {4294967295,4294967295} [4]29; CHECK-NEXT:             [6] %for.inc {4294967295,4294967295} [5]30; CHECK-NEXT:           [5] %return {4294967295,4294967295} [4]31; CHECK-NEXT:       [3] %cleanup16.thread {4294967295,4294967295} [2]32; CHECK-NEXT:     [2] %infinite.loop {4294967295,4294967295} [1]33; CHECK-NEXT: Roots: %entry34 35 36@a = dso_local local_unnamed_addr global i16 0, align 137 38; Function Attrs: nounwind39define dso_local i16 @g(i16 %a0, i16 %a1, i16 %a2, i16 %a3) local_unnamed_addr {40entry:41  %tobool.not = icmp eq i16 %a0, 042  br i1 %tobool.not, label %for.cond1, label %infinite.loop43 44infinite.loop:                                    ; preds = %infinite.loop, %entry45  br label %infinite.loop46 47for.cond1:                                        ; preds = %for.inc19, %entry48  %retval.0 = phi i16 [ %retval.3, %for.inc19 ], [ undef, %entry ]49  %i.0 = phi i16 [ %i.3, %for.inc19 ], [ undef, %entry ]50  %tobool2.not = icmp eq i16 %a1, 051  br i1 %tobool2.not, label %if.end15, label %if.then52 53if.then:                                          ; preds = %for.cond154  %tobool3.not = icmp eq i16 %a2, 055  br i1 %tobool3.not, label %if.end15, label %for.cond5.preheader56 57for.cond5.preheader:                              ; preds = %if.then58  %tobool8.not = icmp eq i16 %a3, 059  %tobool6.not31 = icmp eq i16 %i.0, 060  br i1 %tobool6.not31, label %for.end10, label %for.body761 62for.body7:                                        ; preds = %for.inc, %for.cond5.preheader63  %i.132 = phi i16 [ %inc, %for.inc ], [ %i.0, %for.cond5.preheader ]64  br i1 %tobool8.not, label %for.inc, label %cleanup65 66for.inc:                                          ; preds = %for.body767  %inc = add i16 %i.132, 168  %tobool6.not = icmp eq i16 %inc, 069  br i1 %tobool6.not, label %for.end10, label %for.body770 71for.end10:                                        ; preds = %for.inc, %for.cond5.preheader72  %i.1.lcssa = phi i16 [ %i.0, %for.cond5.preheader ], [ 0, %for.inc ]73  %.26 = select i1 %tobool8.not, i32 0, i32 474  br label %cleanup75 76cleanup:                                          ; preds = %for.end10, %for.body777  %i.128 = phi i16 [ %i.1.lcssa, %for.end10 ], [ %i.0, %for.body7 ]78  %retval.1 = phi i16 [ %retval.0, %for.end10 ], [ 1, %for.body7 ]79  %cond = phi i1 [ %tobool8.not, %for.end10 ], [ false, %for.body7 ]80  %cleanup.dest.slot.0 = phi i32 [ %.26, %for.end10 ], [ 1, %for.body7 ]81  br i1 %cond, label %if.end15, label %cleanup1682 83if.end15:                                         ; preds = %cleanup, %if.then, %for.cond184  %retval.2 = phi i16 [ %retval.1, %cleanup ], [ %retval.0, %if.then ], [ %retval.0, %for.cond1 ]85  %i.2 = phi i16 [ %i.128, %cleanup ], [ %i.0, %if.then ], [ %i.0, %for.cond1 ]86  store i16 0, ptr @a, align 187  br label %cleanup1688 89cleanup16:                                        ; preds = %if.end15, %cleanup90  %retval.3 = phi i16 [ %retval.2, %if.end15 ], [ %retval.1, %cleanup ]91  %i.3 = phi i16 [ %i.2, %if.end15 ], [ %i.128, %cleanup ]92  %cleanup.dest.slot.1 = phi i32 [ 0, %if.end15 ], [ %cleanup.dest.slot.0, %cleanup ]93  switch i32 %cleanup.dest.slot.1, label %unreachable [94    i32 0, label %for.inc1995    i32 1, label %return96    i32 4, label %for.end2197  ]98 99for.inc19:                                        ; preds = %cleanup16100  br label %for.cond1101 102for.end21:                                        ; preds = %cleanup16103  br label %return104 105return:                                           ; preds = %for.end21, %cleanup16106  %retval.4 = phi i16 [ 17, %for.end21 ], [ %retval.3, %cleanup16 ]107  ret i16 %retval.4108 109unreachable:                                      ; preds = %cleanup16110  unreachable111}112