brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.7 KiB · 4f84178 Raw
261 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -passes=early-cse -earlycse-debug-hash -S < %s | FileCheck %s3; RUN: opt -passes='early-cse<memssa>' -S < %s | FileCheck %s4 5define i32 @test_01(i32 %a, i32 %b) {6; CHECK-LABEL: @test_01(7; CHECK-NEXT:  entry:8; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]9; CHECK-NEXT:    br i1 [[COND]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]10; CHECK:       if.true:11; CHECK-NEXT:    ret i32 [[A]]12; CHECK:       if.false:13; CHECK-NEXT:    ret i32 [[B]]14;15entry:16  %cond = icmp slt i32 %a, %b17  br i1 %cond, label %if.true, label %if.false18 19if.true:20  %cond2 = icmp slt i32 %a, %b21  %x = select i1 %cond2, i32 %a, i32 %b22  ret i32 %x23 24if.false:25  %cond3 = icmp slt i32 %a, %b26  %y = select i1 %cond3, i32 %a, i32 %b27  ret i32 %y28}29 30define i32 @test_02(i32 %a, i32 %b, i1 %c) {31; CHECK-LABEL: @test_02(32; CHECK-NEXT:  entry:33; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]34; CHECK-NEXT:    [[AND_COND:%.*]] = and i1 [[COND]], [[C:%.*]]35; CHECK-NEXT:    br i1 [[AND_COND]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]36; CHECK:       if.true:37; CHECK-NEXT:    ret i32 [[A]]38; CHECK:       if.false:39; CHECK-NEXT:    [[Y:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]40; CHECK-NEXT:    ret i32 [[Y]]41;42entry:43  %cond = icmp slt i32 %a, %b44  %and.cond = and i1 %cond, %c45  br i1 %and.cond, label %if.true, label %if.false46 47if.true:48  %cond2 = icmp slt i32 %a, %b49  %x = select i1 %cond2, i32 %a, i32 %b50  ret i32 %x51 52if.false:53  %cond3 = icmp slt i32 %a, %b54  %y = select i1 %cond3, i32 %a, i32 %b55  ret i32 %y56}57 58define i32 @test_02_select(i32 %a, i32 %b, i1 %c) {59; CHECK-LABEL: @test_02_select(60; CHECK-NEXT:  entry:61; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]62; CHECK-NEXT:    [[AND_COND:%.*]] = select i1 [[COND]], i1 [[C:%.*]], i1 false63; CHECK-NEXT:    br i1 [[AND_COND]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]64; CHECK:       if.true:65; CHECK-NEXT:    ret i32 [[A]]66; CHECK:       if.false:67; CHECK-NEXT:    [[Y:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]68; CHECK-NEXT:    ret i32 [[Y]]69;70entry:71  %cond = icmp slt i32 %a, %b72  %and.cond = select i1 %cond, i1 %c, i1 false73  br i1 %and.cond, label %if.true, label %if.false74 75if.true:76  %cond2 = icmp slt i32 %a, %b77  %x = select i1 %cond2, i32 %a, i32 %b78  ret i32 %x79 80if.false:81  %cond3 = icmp slt i32 %a, %b82  %y = select i1 %cond3, i32 %a, i32 %b83  ret i32 %y84}85 86define i32 @test_03(i32 %a, i32 %b, i1 %c) {87; CHECK-LABEL: @test_03(88; CHECK-NEXT:  entry:89; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]90; CHECK-NEXT:    [[OR_COND:%.*]] = or i1 [[COND]], [[C:%.*]]91; CHECK-NEXT:    br i1 [[OR_COND]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]92; CHECK:       if.true:93; CHECK-NEXT:    [[X:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]94; CHECK-NEXT:    ret i32 [[X]]95; CHECK:       if.false:96; CHECK-NEXT:    ret i32 [[B]]97;98entry:99  %cond = icmp slt i32 %a, %b100  %or.cond = or i1 %cond, %c101  br i1 %or.cond, label %if.true, label %if.false102 103if.true:104  %cond2 = icmp slt i32 %a, %b105  %x = select i1 %cond2, i32 %a, i32 %b106  ret i32 %x107 108if.false:109  %cond3 = icmp slt i32 %a, %b110  %y = select i1 %cond3, i32 %a, i32 %b111  ret i32 %y112}113 114define i32 @test_03_select(i32 %a, i32 %b, i1 %c) {115; CHECK-LABEL: @test_03_select(116; CHECK-NEXT:  entry:117; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]118; CHECK-NEXT:    [[OR_COND:%.*]] = select i1 [[COND]], i1 true, i1 [[C:%.*]]119; CHECK-NEXT:    br i1 [[OR_COND]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]120; CHECK:       if.true:121; CHECK-NEXT:    [[X:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]122; CHECK-NEXT:    ret i32 [[X]]123; CHECK:       if.false:124; CHECK-NEXT:    ret i32 [[B]]125;126entry:127  %cond = icmp slt i32 %a, %b128  %or.cond = select i1 %cond, i1 true, i1 %c129  br i1 %or.cond, label %if.true, label %if.false130 131if.true:132  %cond2 = icmp slt i32 %a, %b133  %x = select i1 %cond2, i32 %a, i32 %b134  ret i32 %x135 136if.false:137  %cond3 = icmp slt i32 %a, %b138  %y = select i1 %cond3, i32 %a, i32 %b139  ret i32 %y140}141 142define i32 @test_04(i32 %a, i32 %b, i1 %c1, i1 %c2) {143; CHECK-LABEL: @test_04(144; CHECK-NEXT:  entry:145; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]146; CHECK-NEXT:    [[AND_COND1:%.*]] = and i1 [[COND]], [[C1:%.*]]147; CHECK-NEXT:    [[AND_COND2:%.*]] = and i1 [[AND_COND1]], [[C2:%.*]]148; CHECK-NEXT:    br i1 [[AND_COND2]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]149; CHECK:       if.true:150; CHECK-NEXT:    ret i32 [[A]]151; CHECK:       if.false:152; CHECK-NEXT:    [[Y:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]153; CHECK-NEXT:    ret i32 [[Y]]154;155entry:156  %cond = icmp slt i32 %a, %b157  %and.cond1 = and i1 %cond, %c1158  %and.cond2 = and i1 %and.cond1, %c2159  br i1 %and.cond2, label %if.true, label %if.false160 161if.true:162  %cond2 = icmp slt i32 %a, %b163  %x = select i1 %cond2, i32 %a, i32 %b164  ret i32 %x165 166if.false:167  %cond3 = icmp slt i32 %a, %b168  %y = select i1 %cond3, i32 %a, i32 %b169  ret i32 %y170}171 172define i32 @test_04_select(i32 %a, i32 %b, i1 %c1, i1 %c2) {173; CHECK-LABEL: @test_04_select(174; CHECK-NEXT:  entry:175; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]176; CHECK-NEXT:    [[AND_COND1:%.*]] = select i1 [[COND]], i1 [[C1:%.*]], i1 false177; CHECK-NEXT:    [[AND_COND2:%.*]] = select i1 [[AND_COND1]], i1 [[C2:%.*]], i1 false178; CHECK-NEXT:    br i1 [[AND_COND2]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]179; CHECK:       if.true:180; CHECK-NEXT:    ret i32 [[A]]181; CHECK:       if.false:182; CHECK-NEXT:    [[Y:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]183; CHECK-NEXT:    ret i32 [[Y]]184;185entry:186  %cond = icmp slt i32 %a, %b187  %and.cond1 = select i1 %cond, i1 %c1, i1 false188  %and.cond2 = select i1 %and.cond1, i1 %c2, i1 false189  br i1 %and.cond2, label %if.true, label %if.false190 191if.true:192  %cond2 = icmp slt i32 %a, %b193  %x = select i1 %cond2, i32 %a, i32 %b194  ret i32 %x195 196if.false:197  %cond3 = icmp slt i32 %a, %b198  %y = select i1 %cond3, i32 %a, i32 %b199  ret i32 %y200}201 202define i32 @test_05(i32 %a, i32 %b, i1 %c1, i1 %c2) {203; CHECK-LABEL: @test_05(204; CHECK-NEXT:  entry:205; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]206; CHECK-NEXT:    [[OR_COND1:%.*]] = or i1 [[COND]], [[C1:%.*]]207; CHECK-NEXT:    [[OR_COND2:%.*]] = or i1 [[OR_COND1]], [[C2:%.*]]208; CHECK-NEXT:    br i1 [[OR_COND2]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]209; CHECK:       if.true:210; CHECK-NEXT:    [[X:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]211; CHECK-NEXT:    ret i32 [[X]]212; CHECK:       if.false:213; CHECK-NEXT:    ret i32 [[B]]214;215entry:216  %cond = icmp slt i32 %a, %b217  %or.cond1 = or i1 %cond, %c1218  %or.cond2 = or i1 %or.cond1, %c2219  br i1 %or.cond2, label %if.true, label %if.false220 221if.true:222  %cond2 = icmp slt i32 %a, %b223  %x = select i1 %cond2, i32 %a, i32 %b224  ret i32 %x225 226if.false:227  %cond3 = icmp slt i32 %a, %b228  %y = select i1 %cond3, i32 %a, i32 %b229  ret i32 %y230}231 232define i32 @test_05_select(i32 %a, i32 %b, i1 %c1, i1 %c2) {233; CHECK-LABEL: @test_05_select(234; CHECK-NEXT:  entry:235; CHECK-NEXT:    [[COND:%.*]] = icmp slt i32 [[A:%.*]], [[B:%.*]]236; CHECK-NEXT:    [[OR_COND1:%.*]] = select i1 [[COND]], i1 true, i1 [[C1:%.*]]237; CHECK-NEXT:    [[OR_COND2:%.*]] = select i1 [[OR_COND1]], i1 true, i1 [[C2:%.*]]238; CHECK-NEXT:    br i1 [[OR_COND2]], label [[IF_TRUE:%.*]], label [[IF_FALSE:%.*]]239; CHECK:       if.true:240; CHECK-NEXT:    [[X:%.*]] = select i1 [[COND]], i32 [[A]], i32 [[B]]241; CHECK-NEXT:    ret i32 [[X]]242; CHECK:       if.false:243; CHECK-NEXT:    ret i32 [[B]]244;245entry:246  %cond = icmp slt i32 %a, %b247  %or.cond1 = select i1 %cond, i1 true, i1 %c1248  %or.cond2 = select i1 %or.cond1, i1 true, i1 %c2249  br i1 %or.cond2, label %if.true, label %if.false250 251if.true:252  %cond2 = icmp slt i32 %a, %b253  %x = select i1 %cond2, i32 %a, i32 %b254  ret i32 %x255 256if.false:257  %cond3 = icmp slt i32 %a, %b258  %y = select i1 %cond3, i32 %a, i32 %b259  ret i32 %y260}261