brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.5 KiB · be05d96 Raw
84 lines · plain
1; RUN: opt -passes="ipsccp<func-spec>,print<postdomtree>" -force-specialization -funcspec-max-iters=2 -funcspec-max-clones=1 -funcspec-for-literal-constant=true -S < %s 2>&1 | FileCheck %s2 3; REQUIRES: asserts4 5; This test case is trying to validate that the postdomtree is preserved6; correctly by the ipsccp pass. A tricky bug was introduced in commit7; 1b1232047e83b69561 when PDT would be fetched using getCachedAnalysis in order8; to setup a DomTreeUpdater (to update the PDT during transformation in order9; to preserve the analysis). But given that commit the PDT could end up being10; required and calculated via BlockFrequency analysis. So the problem was that11; when setting up the DomTreeUpdater we used a nullptr in case PDT wasn't12; cached at the beginning of IPSCCP, to indicate that no updates were needed13; for PDT. But then the PDT was calculated, given the input IR, and preserved14; using the non-updated state (as the DTU wasn't configured for updating the15; PDT).16 17; CHECK-NOT: <badref>18; CHECK: Inorder PostDominator Tree: DFSNumbers invalid: 0 slow queries.19; CHECK-NEXT:  [1]  <<exit node>> {4294967295,4294967295} [0]20; CHECK-NEXT:    [2] %for.body {4294967295,4294967295} [1]21; CHECK-NEXT:    [2] %if.end4 {4294967295,4294967295} [1]22; CHECK-NEXT:      [3] %entry {4294967295,4294967295} [2]23; CHECK-NEXT:    [2] %for.body37 {4294967295,4294967295} [1]24; CHECK-NEXT:      [3] %for.cond34 {4294967295,4294967295} [2]25; CHECK-NEXT:        [4] %for.cond16 {4294967295,4294967295} [3]26; CHECK-NEXT: Roots: %for.body %for.body3727; CHECK-NEXT: PostDominatorTree for function: bar28; CHECK-NOT: <badref>29 30declare hidden i1 @compare(ptr) align 231declare hidden { i8, ptr } @getType(ptr) align 232 33define internal void @foo(ptr %TLI, ptr %DL, ptr %Ty, ptr %ValueVTs, ptr %Offsets, i64 %StartingOffset, i1 %arg) {34entry:35  %VT = alloca i64, align 836  br i1 false, label %if.then, label %if.end437 38if.then:                                          ; preds = %entry39  ret void40 41if.end4:                                          ; preds = %entry42  %cmp = call zeroext i1 @compare(ptr undef)43  br i1 %cmp, label %for.body, label %for.cond1644 45for.body:                                         ; preds = %if.end446  %add13 = add i64 %StartingOffset, undef47  call void @foo(ptr %TLI, ptr %DL, ptr undef, ptr %ValueVTs, ptr %Offsets, i64 %add13)48  unreachable49 50for.cond16:                                       ; preds = %for.cond34, %if.end451  %call27 = call { i8, ptr } @getType(ptr %VT)52  br label %for.cond3453 54for.cond34:                                       ; preds = %for.body37, %for.cond1655  br i1 %arg, label %for.body37, label %for.cond1656 57for.body37:                                       ; preds = %for.cond3458  %tobool39 = icmp ne ptr %Offsets, null59  br label %for.cond3460}61 62define hidden { ptr, i32 } @bar(ptr %this) {63entry:64  %Offsets = alloca i64, align 865  %cmp26 = call zeroext i1 @compare(ptr undef)66  br i1 %cmp26, label %for.body28, label %for.cond.cleanup2767 68for.cond.cleanup27:                               ; preds = %entry69  ret { ptr, i32 } undef70 71for.body28:                                       ; preds = %entry72  %call33 = call zeroext i1 @compare(ptr undef)73  br i1 %call33, label %if.then34, label %if.end10674 75if.then34:                                        ; preds = %for.body2876  call void @foo(ptr %this, ptr undef, ptr undef, ptr undef, ptr null, i64 0)77  unreachable78 79if.end106:                                        ; preds = %for.body2880  call void @foo(ptr %this, ptr undef, ptr undef, ptr undef, ptr %Offsets, i64 0)81  unreachable82}83 84