brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · 507ff70 Raw
76 lines · plain
1; This test documents how the IR dumped for loop passes differs with -print-loop-func-scope2; and -print-module-scope3;   - Without -print-loop-func-scope, dumps only the loop, with 3 sections- preheader,4;     loop, and exit blocks5;   - With -print-loop-func-scope, dumps only the function which contains the loop6;   - With -print-module-scope, dumps the entire module containing the loop, and disregards7;     the -print-loop-func-scope flag.8 9; RUN: opt < %s 2>&1 -disable-output \10; RUN: 	   -passes=licm -print-after=licm \11; RUN:	   | FileCheck %s -check-prefix=VANILLA12; RUN: opt < %s 2>&1 -disable-output \13; RUN: 	   -passes=licm -print-after=licm -print-loop-func-scope \14; RUN:	   | FileCheck %s -check-prefix=LOOPFUNC15; RUN: opt < %s 2>&1 -disable-output \16; RUN: 	   -passes=licm -print-after=licm -print-module-scope \17; RUN:	   | FileCheck %s -check-prefix=MODULE18; RUN: opt < %s 2>&1 -disable-output \19; RUN: 	   -passes=licm -print-after=licm -print-module-scope -print-loop-func-scope\20; RUN:	   | FileCheck %s -check-prefix=MODULEWITHLOOP21 22; VANILLA: IR Dump After LICMPass23; VANILLA-NOT: define void @foo24; VANILLA: Preheader:25; VANILLA: Loop:26; VANILLA: Exit blocks27 28; LOOPFUNC: IR Dump After LICMPass29; LOOPFUNC: (loop:30; LOOPFUNC: define void @foo31; LOOPFUNC-NOT: Preheader:32; LOOPFUNC-NOT: Loop:33; LOOPFUNC-NOT: Exit blocks34 35; MODULE: IR Dump After LICMPass36; MODULE: ModuleID =37; MODULE: define void @foo38; MODULE-NOT: Preheader:39; MODULE-NOT: Loop:40; MODULE-NOT: Exit blocks41; MODULE: define void @bar42; MODULE: declare void @baz(i32)43 44; MODULEWITHLOOP: IR Dump After LICMPass45; MODULEWITHLOOP: ModuleID =46; MODULEWITHLOOP: define void @foo47; MODULEWITHLOOP-NOT: Preheader:48; MODULEWITHLOOP-NOT: Loop:49; MODULEWITHLOOP-NOT: Exit blocks50; MODULEWITHLOOP: define void @bar51; MODULEWITHLOOP: declare void @baz(i32)52 53define void @foo(i32 %n) {54entry:55  br label %loop_cond56 57loop_cond:58  %i = phi i32 [ 0, %entry ], [ %i_next, %loop_body ]59  %cmp = icmp slt i32 %i, %n60  br i1 %cmp, label %loop_body, label %loop_end61 62loop_body:63  call void @baz(i32 %i)64  %i_next = add i32 %i, 165  br label %loop_cond66 67loop_end:68  ret void69}70 71define void @bar() {72  ret void73}74 75declare void @baz(i32)76