406 lines · plain
1; RUN: opt -S -passes=verify,iroutliner -o /dev/null \2; RUN: -pass-remarks=iroutliner -pass-remarks-missed=iroutliner < %s \3; RUN: 2>&1 | FileCheck -check-prefix=CHECK %s4; RUN: opt -S -passes=verify,iroutliner -o /dev/null \5; RUN: -pass-remarks-output=%t < %s6; RUN: cat %t | FileCheck -check-prefix=YAML %s7 8; CHECK: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 10 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>9; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 4 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>10; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 0 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>11; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 10 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>12; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 1 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>13; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 11 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>14; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 12 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>15; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 2 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>16; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 3 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>17; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 13 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>18; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 4 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>19; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 14 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>20; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 5 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>21; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 10 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>22; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 11 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>23; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 6 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>24; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 7 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>25; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 17 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>26; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 13 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>27; CHECK-NEXT: remark: <unknown>:0:0: did not outline 2 regions due to estimated increase of 8 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>28; CHECK-NEXT: remark: <unknown>:0:0: outlined 2 regions with decrease of 2 instructions at locations <UNKNOWN LOCATION> <UNKNOWN LOCATION>29 30; YAML: --- !Missed31; YAML-NEXT: Pass: iroutliner32; YAML-NEXT: Name: WouldNotDecreaseSize33; YAML-NEXT: Function: function334; YAML-NEXT: Args:35; YAML-NEXT: - String: 'did not outline '36; YAML-NEXT: - String: '2'37; YAML-NEXT: - String: ' regions due to estimated increase of '38; YAML-NEXT: - InstructionIncrease: '10'39; YAML-NEXT: - String: ' instructions at locations '40; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'41; YAML-NEXT: - String: ' '42; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'43; YAML-NEXT: ...44; YAML-NEXT: --- !Missed45; YAML-NEXT: Pass: iroutliner46; YAML-NEXT: Name: WouldNotDecreaseSize47; YAML-NEXT: Function: function348; YAML-NEXT: Args:49; YAML-NEXT: - String: 'did not outline '50; YAML-NEXT: - String: '2'51; YAML-NEXT: - String: ' regions due to estimated increase of '52; YAML-NEXT: - InstructionIncrease: '4'53; YAML-NEXT: - String: ' instructions at locations '54; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'55; YAML-NEXT: - String: ' '56; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'57; YAML-NEXT: ...58; YAML-NEXT: --- !Missed59; YAML-NEXT: Pass: iroutliner60; YAML-NEXT: Name: WouldNotDecreaseSize61; YAML-NEXT: Function: function362; YAML-NEXT: Args:63; YAML-NEXT: - String: 'did not outline '64; YAML-NEXT: - String: '2'65; YAML-NEXT: - String: ' regions due to estimated increase of '66; YAML-NEXT: - InstructionIncrease: '0'67; YAML-NEXT: - String: ' instructions at locations '68; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'69; YAML-NEXT: - String: ' '70; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'71; YAML-NEXT: ...72; YAML-NEXT: --- !Missed73; YAML-NEXT: Pass: iroutliner74; YAML-NEXT: Name: WouldNotDecreaseSize75; YAML-NEXT: Function: function176; YAML-NEXT: Args:77; YAML-NEXT: - String: 'did not outline '78; YAML-NEXT: - String: '2'79; YAML-NEXT: - String: ' regions due to estimated increase of '80; YAML-NEXT: - InstructionIncrease: '10'81; YAML-NEXT: - String: ' instructions at locations '82; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'83; YAML-NEXT: - String: ' '84; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'85; YAML-NEXT: ...86; YAML-NEXT: --- !Missed87; YAML-NEXT: Pass: iroutliner88; YAML-NEXT: Name: WouldNotDecreaseSize89; YAML-NEXT: Function: function390; YAML-NEXT: Args:91; YAML-NEXT: - String: 'did not outline '92; YAML-NEXT: - String: '2'93; YAML-NEXT: - String: ' regions due to estimated increase of '94; YAML-NEXT: - InstructionIncrease: '1'95; YAML-NEXT: - String: ' instructions at locations '96; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'97; YAML-NEXT: - String: ' '98; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'99; YAML-NEXT: ...100; YAML-NEXT: --- !Missed101; YAML-NEXT: Pass: iroutliner102; YAML-NEXT: Name: WouldNotDecreaseSize103; YAML-NEXT: Function: function1104; YAML-NEXT: Args:105; YAML-NEXT: - String: 'did not outline '106; YAML-NEXT: - String: '2'107; YAML-NEXT: - String: ' regions due to estimated increase of '108; YAML-NEXT: - InstructionIncrease: '11'109; YAML-NEXT: - String: ' instructions at locations '110; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'111; YAML-NEXT: - String: ' '112; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'113; YAML-NEXT: ...114; YAML-NEXT: --- !Missed115; YAML-NEXT: Pass: iroutliner116; YAML-NEXT: Name: WouldNotDecreaseSize117; YAML-NEXT: Function: function1118; YAML-NEXT: Args:119; YAML-NEXT: - String: 'did not outline '120; YAML-NEXT: - String: '2'121; YAML-NEXT: - String: ' regions due to estimated increase of '122; YAML-NEXT: - InstructionIncrease: '12'123; YAML-NEXT: - String: ' instructions at locations '124; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'125; YAML-NEXT: - String: ' '126; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'127; YAML-NEXT: ...128; YAML-NEXT: --- !Missed129; YAML-NEXT: Pass: iroutliner130; YAML-NEXT: Name: WouldNotDecreaseSize131; YAML-NEXT: Function: function3132; YAML-NEXT: Args:133; YAML-NEXT: - String: 'did not outline '134; YAML-NEXT: - String: '2'135; YAML-NEXT: - String: ' regions due to estimated increase of '136; YAML-NEXT: - InstructionIncrease: '2'137; YAML-NEXT: - String: ' instructions at locations '138; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'139; YAML-NEXT: - String: ' '140; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'141; YAML-NEXT: ...142; YAML-NEXT: --- !Missed143; YAML-NEXT: Pass: iroutliner144; YAML-NEXT: Name: WouldNotDecreaseSize145; YAML-NEXT: Function: function3146; YAML-NEXT: Args:147; YAML-NEXT: - String: 'did not outline '148; YAML-NEXT: - String: '2'149; YAML-NEXT: - String: ' regions due to estimated increase of '150; YAML-NEXT: - InstructionIncrease: '3'151; YAML-NEXT: - String: ' instructions at locations '152; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'153; YAML-NEXT: - String: ' '154; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'155; YAML-NEXT: ...156; YAML-NEXT: --- !Missed157; YAML-NEXT: Pass: iroutliner158; YAML-NEXT: Name: WouldNotDecreaseSize159; YAML-NEXT: Function: function1160; YAML-NEXT: Args:161; YAML-NEXT: - String: 'did not outline '162; YAML-NEXT: - String: '2'163; YAML-NEXT: - String: ' regions due to estimated increase of '164; YAML-NEXT: - InstructionIncrease: '13'165; YAML-NEXT: - String: ' instructions at locations '166; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'167; YAML-NEXT: - String: ' '168; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'169; YAML-NEXT: ...170; YAML-NEXT: --- !Missed171; YAML-NEXT: Pass: iroutliner172; YAML-NEXT: Name: WouldNotDecreaseSize173; YAML-NEXT: Function: function3174; YAML-NEXT: Args:175; YAML-NEXT: - String: 'did not outline '176; YAML-NEXT: - String: '2'177; YAML-NEXT: - String: ' regions due to estimated increase of '178; YAML-NEXT: - InstructionIncrease: '4'179; YAML-NEXT: - String: ' instructions at locations '180; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'181; YAML-NEXT: - String: ' '182; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'183; YAML-NEXT: ...184; YAML-NEXT: --- !Missed185; YAML-NEXT: Pass: iroutliner186; YAML-NEXT: Name: WouldNotDecreaseSize187; YAML-NEXT: Function: function1188; YAML-NEXT: Args:189; YAML-NEXT: - String: 'did not outline '190; YAML-NEXT: - String: '2'191; YAML-NEXT: - String: ' regions due to estimated increase of '192; YAML-NEXT: - InstructionIncrease: '14'193; YAML-NEXT: - String: ' instructions at locations '194; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'195; YAML-NEXT: - String: ' '196; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'197; YAML-NEXT: ...198; YAML-NEXT: --- !Missed199; YAML-NEXT: Pass: iroutliner200; YAML-NEXT: Name: WouldNotDecreaseSize201; YAML-NEXT: Function: function3202; YAML-NEXT: Args:203; YAML-NEXT: - String: 'did not outline '204; YAML-NEXT: - String: '2'205; YAML-NEXT: - String: ' regions due to estimated increase of '206; YAML-NEXT: - InstructionIncrease: '5'207; YAML-NEXT: - String: ' instructions at locations '208; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'209; YAML-NEXT: - String: ' '210; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'211; YAML-NEXT: ...212; YAML-NEXT: --- !Missed213; YAML-NEXT: Pass: iroutliner214; YAML-NEXT: Name: WouldNotDecreaseSize215; YAML-NEXT: Function: function1216; YAML-NEXT: Args:217; YAML-NEXT: - String: 'did not outline '218; YAML-NEXT: - String: '2'219; YAML-NEXT: - String: ' regions due to estimated increase of '220; YAML-NEXT: - InstructionIncrease: '10'221; YAML-NEXT: - String: ' instructions at locations '222; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'223; YAML-NEXT: - String: ' '224; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'225; YAML-NEXT: ...226; YAML-NEXT: --- !Missed227; YAML-NEXT: Pass: iroutliner228; YAML-NEXT: Name: WouldNotDecreaseSize229; YAML-NEXT: Function: function1230; YAML-NEXT: Args:231; YAML-NEXT: - String: 'did not outline '232; YAML-NEXT: - String: '2'233; YAML-NEXT: - String: ' regions due to estimated increase of '234; YAML-NEXT: - InstructionIncrease: '11'235; YAML-NEXT: - String: ' instructions at locations '236; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'237; YAML-NEXT: - String: ' '238; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'239; YAML-NEXT: ...240; YAML-NEXT: --- !Missed241; YAML-NEXT: Pass: iroutliner242; YAML-NEXT: Name: WouldNotDecreaseSize243; YAML-NEXT: Function: function3244; YAML-NEXT: Args:245; YAML-NEXT: - String: 'did not outline '246; YAML-NEXT: - String: '2'247; YAML-NEXT: - String: ' regions due to estimated increase of '248; YAML-NEXT: - InstructionIncrease: '6'249; YAML-NEXT: - String: ' instructions at locations '250; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'251; YAML-NEXT: - String: ' '252; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'253; YAML-NEXT: ...254; YAML-NEXT: --- !Missed255; YAML-NEXT: Pass: iroutliner256; YAML-NEXT: Name: WouldNotDecreaseSize257; YAML-NEXT: Function: function3258; YAML-NEXT: Args:259; YAML-NEXT: - String: 'did not outline '260; YAML-NEXT: - String: '2'261; YAML-NEXT: - String: ' regions due to estimated increase of '262; YAML-NEXT: - InstructionIncrease: '7'263; YAML-NEXT: - String: ' instructions at locations '264; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'265; YAML-NEXT: - String: ' '266; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'267; YAML-NEXT: ...268; YAML-NEXT: --- !Missed269; YAML-NEXT: Pass: iroutliner270; YAML-NEXT: Name: WouldNotDecreaseSize271; YAML-NEXT: Function: function1272; YAML-NEXT: Args:273; YAML-NEXT: - String: 'did not outline '274; YAML-NEXT: - String: '2'275; YAML-NEXT: - String: ' regions due to estimated increase of '276; YAML-NEXT: - InstructionIncrease: '17'277; YAML-NEXT: - String: ' instructions at locations '278; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'279; YAML-NEXT: - String: ' '280; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'281; YAML-NEXT: ...282; YAML-NEXT: --- !Missed283; YAML-NEXT: Pass: iroutliner284; YAML-NEXT: Name: WouldNotDecreaseSize285; YAML-NEXT: Function: function1286; YAML-NEXT: Args:287; YAML-NEXT: - String: 'did not outline '288; YAML-NEXT: - String: '2'289; YAML-NEXT: - String: ' regions due to estimated increase of '290; YAML-NEXT: - InstructionIncrease: '13'291; YAML-NEXT: - String: ' instructions at locations '292; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'293; YAML-NEXT: - String: ' '294; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'295; YAML-NEXT: ...296; YAML-NEXT: --- !Missed297; YAML-NEXT: Pass: iroutliner298; YAML-NEXT: Name: WouldNotDecreaseSize299; YAML-NEXT: Function: function3300; YAML-NEXT: Args:301; YAML-NEXT: - String: 'did not outline '302; YAML-NEXT: - String: '2'303; YAML-NEXT: - String: ' regions due to estimated increase of '304; YAML-NEXT: - InstructionIncrease: '8'305; YAML-NEXT: - String: ' instructions at locations '306; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'307; YAML-NEXT: - String: ' '308; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'309; YAML-NEXT: ...310; YAML-NEXT: --- !Passed311; YAML-NEXT: Pass: iroutliner312; YAML-NEXT: Name: Outlined313; YAML-NEXT: Function: function3.outlined314; YAML-NEXT: Args:315; YAML-NEXT: - String: 'outlined '316; YAML-NEXT: - String: '2'317; YAML-NEXT: - String: ' regions with decrease of '318; YAML-NEXT: - Benefit: '2'319; YAML-NEXT: - String: ' instructions at locations '320; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'321; YAML-NEXT: - String: ' '322; YAML-NEXT: - DebugLoc: '<UNKNOWN LOCATION>'323; YAML-NEXT: ...324 325define void @function1() #0 {326entry:327 %a = alloca i32, align 4328 %b = alloca i32, align 4329 %output = alloca i32, align 4330 %result = alloca i32, align 4331 store i32 2, ptr %a, align 4332 store i32 3, ptr %b, align 4333 %0 = load i32, ptr %a, align 4334 %1 = load i32, ptr %b, align 4335 %add = add i32 %0, %1336 store i32 %add, ptr %output, align 4337 %2 = load i32, ptr %output, align 4338 %3 = load i32, ptr %output, align 4339 %mul = mul i32 %2, %add340 store i32 %mul, ptr %result, align 4341 ret void342}343 344define void @function2() #0 {345entry:346 %a = alloca i32, align 4347 %b = alloca i32, align 4348 %output = alloca i32, align 4349 %result = alloca i32, align 4350 store i32 2, ptr %a, align 4351 store i32 3, ptr %b, align 4352 %0 = load i32, ptr %a, align 4353 %1 = load i32, ptr %b, align 4354 %add = add i32 %0, %1355 store i32 %add, ptr %output, align 4356 %2 = load i32, ptr %output, align 4357 %3 = load i32, ptr %output, align 4358 %mul = mul i32 %2, %add359 store i32 %mul, ptr %result, align 4360 ret void361}362 363define void @function3() #0 {364entry:365 %a = alloca i32, align 4366 %b = alloca i32, align 4367 %0 = load i32, ptr %a, align 4368 %1 = load i32, ptr %b, align 4369 %add = add i32 %0, %1370 %mul = mul i32 %0, %1371 %sub = sub i32 %0, %1372 %div = sdiv i32 %0, %1373 %add1 = add i32 %0, %1374 %mul1 = mul i32 %0, %1375 %sub1 = sub i32 %0, %1376 %div1 = sdiv i32 %0, %1377 %add2 = add i32 %0, %1378 %mul2 = mul i32 %0, %1379 %sub2 = sub i32 %0, %1380 %div2 = sdiv i32 %0, %1381 %mul3 = mul i32 %0, %1382 ret void383}384 385define void @function4() #0 {386entry:387 %a = alloca i32, align 4388 %b = alloca i32, align 4389 %0 = load i32, ptr %a, align 4390 %1 = load i32, ptr %b, align 4391 %add = add i32 %0, %1392 %mul = mul i32 %0, %1393 %sub = sub i32 %0, %1394 %div = sdiv i32 %0, %1395 %add1 = add i32 %0, %1396 %mul1 = mul i32 %0, %1397 %sub1 = sub i32 %0, %1398 %div1 = sdiv i32 %0, %1399 %add2 = add i32 %0, %1400 %mul2 = mul i32 %0, %1401 %sub2 = sub i32 %0, %1402 %div2 = sdiv i32 %0, %1403 %div3 = sdiv i32 %0, %1404 ret void405}406