brintos

brintos / llvm-project-archived public Read only

0
0
Text · 64.1 KiB · 78b4139 Raw
1533 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 52; RUN: opt -passes='print<hash-recognize>' -disable-output %s 2>&1 | FileCheck %s3 4define i16 @crc16.le.tc8(i8 %msg, i16 %checksum) {5; CHECK-LABEL: 'crc16.le.tc8'6; CHECK-NEXT:  Found little-endian CRC-16 loop with trip count 87; CHECK-NEXT:    Initial CRC: i16 %checksum8; CHECK-NEXT:    Generating polynomial: 409619; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor10; CHECK-NEXT:    Auxiliary data: i8 %msg11; CHECK-NEXT:    Computed CRC lookup table:12; CHECK-NEXT:  0 49345 49537 320 49921 960 640 49729 50689 1728 1920 51009 1280 50625 50305 108813; CHECK-NEXT:  52225 3264 3456 52545 3840 53185 52865 3648 2560 51905 52097 2880 51457 2496 2176 5126514; CHECK-NEXT:  55297 6336 6528 55617 6912 56257 55937 6720 7680 57025 57217 8000 56577 7616 7296 5638515; CHECK-NEXT:  5120 54465 54657 5440 55041 6080 5760 54849 53761 4800 4992 54081 4352 53697 53377 416016; CHECK-NEXT:  61441 12480 12672 61761 13056 62401 62081 12864 13824 63169 63361 14144 62721 13760 13440 6252917; CHECK-NEXT:  15360 64705 64897 15680 65281 16320 16000 65089 64001 15040 15232 64321 14592 63937 63617 1440018; CHECK-NEXT:  10240 59585 59777 10560 60161 11200 10880 59969 60929 11968 12160 61249 11520 60865 60545 1132819; CHECK-NEXT:  58369 9408 9600 58689 9984 59329 59009 9792 8704 58049 58241 9024 57601 8640 8320 5740920; CHECK-NEXT:  40961 24768 24960 41281 25344 41921 41601 25152 26112 42689 42881 26432 42241 26048 25728 4204921; CHECK-NEXT:  27648 44225 44417 27968 44801 28608 28288 44609 43521 27328 27520 43841 26880 43457 43137 2668822; CHECK-NEXT:  30720 47297 47489 31040 47873 31680 31360 47681 48641 32448 32640 48961 32000 48577 48257 3180823; CHECK-NEXT:  46081 29888 30080 46401 30464 47041 46721 30272 29184 45761 45953 29504 45313 29120 28800 4512124; CHECK-NEXT:  20480 37057 37249 20800 37633 21440 21120 37441 38401 22208 22400 38721 21760 38337 38017 2156825; CHECK-NEXT:  39937 23744 23936 40257 24320 40897 40577 24128 23040 39617 39809 23360 39169 22976 22656 3897726; CHECK-NEXT:  34817 18624 18816 35137 19200 35777 35457 19008 19968 36545 36737 20288 36097 19904 19584 3590527; CHECK-NEXT:  17408 33985 34177 17728 34561 18368 18048 34369 33281 17088 17280 33601 16640 33217 32897 1644828;29entry:30  br label %loop31 32loop:                                              ; preds = %loop, %entry33  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]34  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]35  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]36  %crc.trunc = trunc i16 %crc to i837  %xor.data.crc = xor i8 %data, %crc.trunc38  %and.data.crc = and i8 %xor.data.crc, 139  %data.next = lshr i8 %data, 140  %check.sb = icmp eq i8 %and.data.crc, 041  %crc.lshr = lshr i16 %crc, 142  %xor = xor i16 %crc.lshr, -2457543  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor44  %iv.next = add nuw nsw i8 %iv, 145  %exit.cond = icmp samesign ult i8 %iv, 746  br i1 %exit.cond, label %loop, label %exit47 48exit:                                              ; preds = %loop49  ret i16 %crc.next50}51 52define i16 @crc16.le.tc8.udiv(i8 %msg, i16 %checksum) {53; CHECK-LABEL: 'crc16.le.tc8.udiv'54; CHECK-NEXT:  Found little-endian CRC-16 loop with trip count 855; CHECK-NEXT:    Initial CRC: i16 %checksum56; CHECK-NEXT:    Generating polynomial: 4096157; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor58; CHECK-NEXT:    Auxiliary data: i8 %msg59; CHECK-NEXT:    Computed CRC lookup table:60; CHECK-NEXT:  0 49345 49537 320 49921 960 640 49729 50689 1728 1920 51009 1280 50625 50305 108861; CHECK-NEXT:  52225 3264 3456 52545 3840 53185 52865 3648 2560 51905 52097 2880 51457 2496 2176 5126562; CHECK-NEXT:  55297 6336 6528 55617 6912 56257 55937 6720 7680 57025 57217 8000 56577 7616 7296 5638563; CHECK-NEXT:  5120 54465 54657 5440 55041 6080 5760 54849 53761 4800 4992 54081 4352 53697 53377 416064; CHECK-NEXT:  61441 12480 12672 61761 13056 62401 62081 12864 13824 63169 63361 14144 62721 13760 13440 6252965; CHECK-NEXT:  15360 64705 64897 15680 65281 16320 16000 65089 64001 15040 15232 64321 14592 63937 63617 1440066; CHECK-NEXT:  10240 59585 59777 10560 60161 11200 10880 59969 60929 11968 12160 61249 11520 60865 60545 1132867; CHECK-NEXT:  58369 9408 9600 58689 9984 59329 59009 9792 8704 58049 58241 9024 57601 8640 8320 5740968; CHECK-NEXT:  40961 24768 24960 41281 25344 41921 41601 25152 26112 42689 42881 26432 42241 26048 25728 4204969; CHECK-NEXT:  27648 44225 44417 27968 44801 28608 28288 44609 43521 27328 27520 43841 26880 43457 43137 2668870; CHECK-NEXT:  30720 47297 47489 31040 47873 31680 31360 47681 48641 32448 32640 48961 32000 48577 48257 3180871; CHECK-NEXT:  46081 29888 30080 46401 30464 47041 46721 30272 29184 45761 45953 29504 45313 29120 28800 4512172; CHECK-NEXT:  20480 37057 37249 20800 37633 21440 21120 37441 38401 22208 22400 38721 21760 38337 38017 2156873; CHECK-NEXT:  39937 23744 23936 40257 24320 40897 40577 24128 23040 39617 39809 23360 39169 22976 22656 3897774; CHECK-NEXT:  34817 18624 18816 35137 19200 35777 35457 19008 19968 36545 36737 20288 36097 19904 19584 3590575; CHECK-NEXT:  17408 33985 34177 17728 34561 18368 18048 34369 33281 17088 17280 33601 16640 33217 32897 1644876;77entry:78  br label %loop79 80loop:                                              ; preds = %loop, %entry81  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]82  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]83  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]84  %crc.trunc = trunc i16 %crc to i885  %xor.data.crc = xor i8 %data, %crc.trunc86  %and.data.crc = and i8 %xor.data.crc, 187  %data.next = udiv i8 %data, 288  %check.sb = icmp eq i8 %and.data.crc, 089  %crc.lshr = udiv i16 %crc, 290  %xor = xor i16 %crc.lshr, -2457591  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor92  %iv.next = add nuw nsw i8 %iv, 193  %exit.cond = icmp samesign ult i8 %iv, 794  br i1 %exit.cond, label %loop, label %exit95 96exit:                                              ; preds = %loop97  ret i16 %crc.next98}99 100define i16 @crc16.le.tc16(i16 %msg, i16 %checksum) {101; CHECK-LABEL: 'crc16.le.tc16'102; CHECK-NEXT:  Found little-endian CRC-16 loop with trip count 16103; CHECK-NEXT:    Initial CRC: i16 %checksum104; CHECK-NEXT:    Generating polynomial: 40961105; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor106; CHECK-NEXT:    Auxiliary data: i16 %msg107; CHECK-NEXT:    Computed CRC lookup table:108; CHECK-NEXT:  0 49345 49537 320 49921 960 640 49729 50689 1728 1920 51009 1280 50625 50305 1088109; CHECK-NEXT:  52225 3264 3456 52545 3840 53185 52865 3648 2560 51905 52097 2880 51457 2496 2176 51265110; CHECK-NEXT:  55297 6336 6528 55617 6912 56257 55937 6720 7680 57025 57217 8000 56577 7616 7296 56385111; CHECK-NEXT:  5120 54465 54657 5440 55041 6080 5760 54849 53761 4800 4992 54081 4352 53697 53377 4160112; CHECK-NEXT:  61441 12480 12672 61761 13056 62401 62081 12864 13824 63169 63361 14144 62721 13760 13440 62529113; CHECK-NEXT:  15360 64705 64897 15680 65281 16320 16000 65089 64001 15040 15232 64321 14592 63937 63617 14400114; CHECK-NEXT:  10240 59585 59777 10560 60161 11200 10880 59969 60929 11968 12160 61249 11520 60865 60545 11328115; CHECK-NEXT:  58369 9408 9600 58689 9984 59329 59009 9792 8704 58049 58241 9024 57601 8640 8320 57409116; CHECK-NEXT:  40961 24768 24960 41281 25344 41921 41601 25152 26112 42689 42881 26432 42241 26048 25728 42049117; CHECK-NEXT:  27648 44225 44417 27968 44801 28608 28288 44609 43521 27328 27520 43841 26880 43457 43137 26688118; CHECK-NEXT:  30720 47297 47489 31040 47873 31680 31360 47681 48641 32448 32640 48961 32000 48577 48257 31808119; CHECK-NEXT:  46081 29888 30080 46401 30464 47041 46721 30272 29184 45761 45953 29504 45313 29120 28800 45121120; CHECK-NEXT:  20480 37057 37249 20800 37633 21440 21120 37441 38401 22208 22400 38721 21760 38337 38017 21568121; CHECK-NEXT:  39937 23744 23936 40257 24320 40897 40577 24128 23040 39617 39809 23360 39169 22976 22656 38977122; CHECK-NEXT:  34817 18624 18816 35137 19200 35777 35457 19008 19968 36545 36737 20288 36097 19904 19584 35905123; CHECK-NEXT:  17408 33985 34177 17728 34561 18368 18048 34369 33281 17088 17280 33601 16640 33217 32897 16448124;125entry:126  br label %loop127 128loop:                                              ; preds = %loop, %entry129  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]130  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]131  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]132  %xor.crc.data = xor i16 %crc, %data133  %and.crc.data = and i16 %xor.crc.data, 1134  %data.next = lshr i16 %data, 1135  %check.sb = icmp eq i16 %and.crc.data, 0136  %crc.lshr = lshr i16 %crc, 1137  %crc.xor = xor i16 %crc.lshr, -24575138  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor139  %iv.next = add nuw nsw i8 %iv, 1140  %exit.cond = icmp samesign ult i8 %iv, 15141  br i1 %exit.cond, label %loop, label %exit142 143exit:                                              ; preds = %loop144  ret i16 %crc.next145}146 147define i8 @crc8.le.tc16(i16 %msg, i8 %checksum) {148; CHECK-LABEL: 'crc8.le.tc16'149; CHECK-NEXT:  Found little-endian CRC-8 loop with trip count 16150; CHECK-NEXT:    Initial CRC: i8 %checksum151; CHECK-NEXT:    Generating polynomial: 29152; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i8 %crc.lshr, i8 %crc.xor153; CHECK-NEXT:    Auxiliary data: i16 %msg154; CHECK-NEXT:    Computed CRC lookup table:155; CHECK-NEXT:  0 9 18 27 31 22 13 4 5 12 23 30 26 19 8 1156; CHECK-NEXT:  10 3 24 17 21 28 7 14 15 6 29 20 16 25 2 11157; CHECK-NEXT:  20 29 6 15 11 2 25 16 17 24 3 10 14 7 28 21158; CHECK-NEXT:  30 23 12 5 1 8 19 26 27 18 9 0 4 13 22 31159; CHECK-NEXT:  19 26 1 8 12 5 30 23 22 31 4 13 9 0 27 18160; CHECK-NEXT:  25 16 11 2 6 15 20 29 28 21 14 7 3 10 17 24161; CHECK-NEXT:  7 14 21 28 24 17 10 3 2 11 16 25 29 20 15 6162; CHECK-NEXT:  13 4 31 22 18 27 0 9 8 1 26 19 23 30 5 12163; CHECK-NEXT:  29 20 15 6 2 11 16 25 24 17 10 3 7 14 21 28164; CHECK-NEXT:  23 30 5 12 8 1 26 19 18 27 0 9 13 4 31 22165; CHECK-NEXT:  9 0 27 18 22 31 4 13 12 5 30 23 19 26 1 8166; CHECK-NEXT:  3 10 17 24 28 21 14 7 6 15 20 29 25 16 11 2167; CHECK-NEXT:  14 7 28 21 17 24 3 10 11 2 25 16 20 29 6 15168; CHECK-NEXT:  4 13 22 31 27 18 9 0 1 8 19 26 30 23 12 5169; CHECK-NEXT:  26 19 8 1 5 12 23 30 31 22 13 4 0 9 18 27170; CHECK-NEXT:  16 25 2 11 15 6 29 20 21 28 7 14 10 3 24 17171;172entry:173  br label %loop174 175loop:                                              ; preds = %loop, %entry176  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]177  %crc = phi i8 [ %checksum, %entry ], [ %crc.next, %loop ]178  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]179  %data.trunc = trunc i16 %data to i8180  %xor.crc.data = xor i8 %crc, %data.trunc181  %and.crc.data = and i8 %xor.crc.data, 1182  %data.next = lshr i16 %data, 1183  %check.sb = icmp eq i8 %and.crc.data, 0184  %crc.lshr = lshr i8 %crc, 1185  %crc.xor = xor i8 %crc.lshr, 29186  %crc.next = select i1 %check.sb, i8 %crc.lshr, i8 %crc.xor187  %iv.next = add nuw nsw i8 %iv, 1188  %exit.cond = icmp samesign ult i8 %iv, 15189  br i1 %exit.cond, label %loop, label %exit190 191exit:                                              ; preds = %loop192  ret i8 %crc.next193}194 195define i16 @crc16.be.tc8.crc.init.li(i16 %checksum, i8 %msg) {196; CHECK-LABEL: 'crc16.be.tc8.crc.init.li'197; CHECK-NEXT:  Found big-endian CRC-16 loop with trip count 8198; CHECK-NEXT:    Initial CRC: %crc.init = xor i16 %msg.shl, %checksum199; CHECK-NEXT:    Generating polynomial: 4129200; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl201; CHECK-NEXT:    Computed CRC lookup table:202; CHECK-NEXT:  0 4129 8258 12387 16516 20645 24774 28903 33032 37161 41290 45419 49548 53677 57806 61935203; CHECK-NEXT:  4657 528 12915 8786 21173 17044 29431 25302 37689 33560 45947 41818 54205 50076 62463 58334204; CHECK-NEXT:  9314 13379 1056 5121 25830 29895 17572 21637 42346 46411 34088 38153 58862 62927 50604 54669205; CHECK-NEXT:  13907 9842 5649 1584 30423 26358 22165 18100 46939 42874 38681 34616 63455 59390 55197 51132206; CHECK-NEXT:  18628 22757 26758 30887 2112 6241 10242 14371 51660 55789 59790 63919 35144 39273 43274 47403207; CHECK-NEXT:  23285 19156 31415 27286 6769 2640 14899 10770 56317 52188 64447 60318 39801 35672 47931 43802208; CHECK-NEXT:  27814 31879 19684 23749 11298 15363 3168 7233 60846 64911 52716 56781 44330 48395 36200 40265209; CHECK-NEXT:  32407 28342 24277 20212 15891 11826 7761 3696 65439 61374 57309 53244 48923 44858 40793 36728210; CHECK-NEXT:  37256 33193 45514 41451 53516 49453 61774 57711 4224 161 12482 8419 20484 16421 28742 24679211; CHECK-NEXT:  33721 37784 41979 46042 49981 54044 58239 62302 689 4752 8947 13010 16949 21012 25207 29270212; CHECK-NEXT:  46570 42443 38312 34185 62830 58703 54572 50445 13538 9411 5280 1153 29798 25671 21540 17413213; CHECK-NEXT:  42971 47098 34713 38840 59231 63358 50973 55100 9939 14066 1681 5808 26199 30326 17941 22068214; CHECK-NEXT:  55628 51565 63758 59695 39368 35305 47498 43435 22596 18533 30726 26663 6336 2273 14466 10403215; CHECK-NEXT:  52093 56156 60223 64286 35833 39896 43963 48026 19061 23124 27191 31254 2801 6864 10931 14994216; CHECK-NEXT:  64814 60687 56684 52557 48554 44427 40424 36297 31782 27655 23652 19525 15522 11395 7392 3265217; CHECK-NEXT:  61215 65342 53085 57212 44955 49082 36825 40952 28183 32310 20053 24180 11923 16050 3793 7920218;219entry:220  %msg.ext = zext i8 %msg to i16221  %msg.shl = shl nuw i16 %msg.ext, 8222  %crc.init = xor i16 %msg.shl, %checksum223  br label %loop224 225loop:                                              ; preds = %loop, %entry226  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]227  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]228  %crc.shl = shl i16 %crc, 1229  %crc.xor = xor i16 %crc.shl, 4129230  %check.sb = icmp slt i16 %crc, 0231  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl232  %iv.next = add nuw nsw i32 %iv, 1233  %exit.cond = icmp samesign ult i32 %iv, 7234  br i1 %exit.cond, label %loop, label %exit235 236exit:                                              ; preds = %loop237  ret i16 %crc.next238}239 240define i16 @crc16.be.tc8.crc.init.arg(i16 %crc.init) {241; CHECK-LABEL: 'crc16.be.tc8.crc.init.arg'242; CHECK-NEXT:  Found big-endian CRC-16 loop with trip count 8243; CHECK-NEXT:    Initial CRC: i16 %crc.init244; CHECK-NEXT:    Generating polynomial: 4129245; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl246; CHECK-NEXT:    Computed CRC lookup table:247; CHECK-NEXT:  0 4129 8258 12387 16516 20645 24774 28903 33032 37161 41290 45419 49548 53677 57806 61935248; CHECK-NEXT:  4657 528 12915 8786 21173 17044 29431 25302 37689 33560 45947 41818 54205 50076 62463 58334249; CHECK-NEXT:  9314 13379 1056 5121 25830 29895 17572 21637 42346 46411 34088 38153 58862 62927 50604 54669250; CHECK-NEXT:  13907 9842 5649 1584 30423 26358 22165 18100 46939 42874 38681 34616 63455 59390 55197 51132251; CHECK-NEXT:  18628 22757 26758 30887 2112 6241 10242 14371 51660 55789 59790 63919 35144 39273 43274 47403252; CHECK-NEXT:  23285 19156 31415 27286 6769 2640 14899 10770 56317 52188 64447 60318 39801 35672 47931 43802253; CHECK-NEXT:  27814 31879 19684 23749 11298 15363 3168 7233 60846 64911 52716 56781 44330 48395 36200 40265254; CHECK-NEXT:  32407 28342 24277 20212 15891 11826 7761 3696 65439 61374 57309 53244 48923 44858 40793 36728255; CHECK-NEXT:  37256 33193 45514 41451 53516 49453 61774 57711 4224 161 12482 8419 20484 16421 28742 24679256; CHECK-NEXT:  33721 37784 41979 46042 49981 54044 58239 62302 689 4752 8947 13010 16949 21012 25207 29270257; CHECK-NEXT:  46570 42443 38312 34185 62830 58703 54572 50445 13538 9411 5280 1153 29798 25671 21540 17413258; CHECK-NEXT:  42971 47098 34713 38840 59231 63358 50973 55100 9939 14066 1681 5808 26199 30326 17941 22068259; CHECK-NEXT:  55628 51565 63758 59695 39368 35305 47498 43435 22596 18533 30726 26663 6336 2273 14466 10403260; CHECK-NEXT:  52093 56156 60223 64286 35833 39896 43963 48026 19061 23124 27191 31254 2801 6864 10931 14994261; CHECK-NEXT:  64814 60687 56684 52557 48554 44427 40424 36297 31782 27655 23652 19525 15522 11395 7392 3265262; CHECK-NEXT:  61215 65342 53085 57212 44955 49082 36825 40952 28183 32310 20053 24180 11923 16050 3793 7920263;264entry:265  br label %loop266 267loop:                                              ; preds = %loop, %entry268  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]269  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]270  %crc.shl = shl i16 %crc, 1271  %crc.xor = xor i16 %crc.shl, 4129272  %check.sb = icmp slt i16 %crc, 0273  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl274  %iv.next = add nuw nsw i32 %iv, 1275  %exit.cond = icmp samesign ult i32 %iv, 7276  br i1 %exit.cond, label %loop, label %exit277 278exit:                                              ; preds = %loop279  ret i16 %crc.next280}281 282define i16 @crc16.be.tc8.crc.init.arg.flipped.sb.check(i16 %crc.init) {283; CHECK-LABEL: 'crc16.be.tc8.crc.init.arg.flipped.sb.check'284; CHECK-NEXT:  Found big-endian CRC-16 loop with trip count 8285; CHECK-NEXT:    Initial CRC: i16 %crc.init286; CHECK-NEXT:    Generating polynomial: 4129287; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor288; CHECK-NEXT:    Computed CRC lookup table:289; CHECK-NEXT:  0 4129 8258 12387 16516 20645 24774 28903 33032 37161 41290 45419 49548 53677 57806 61935290; CHECK-NEXT:  4657 528 12915 8786 21173 17044 29431 25302 37689 33560 45947 41818 54205 50076 62463 58334291; CHECK-NEXT:  9314 13379 1056 5121 25830 29895 17572 21637 42346 46411 34088 38153 58862 62927 50604 54669292; CHECK-NEXT:  13907 9842 5649 1584 30423 26358 22165 18100 46939 42874 38681 34616 63455 59390 55197 51132293; CHECK-NEXT:  18628 22757 26758 30887 2112 6241 10242 14371 51660 55789 59790 63919 35144 39273 43274 47403294; CHECK-NEXT:  23285 19156 31415 27286 6769 2640 14899 10770 56317 52188 64447 60318 39801 35672 47931 43802295; CHECK-NEXT:  27814 31879 19684 23749 11298 15363 3168 7233 60846 64911 52716 56781 44330 48395 36200 40265296; CHECK-NEXT:  32407 28342 24277 20212 15891 11826 7761 3696 65439 61374 57309 53244 48923 44858 40793 36728297; CHECK-NEXT:  37256 33193 45514 41451 53516 49453 61774 57711 4224 161 12482 8419 20484 16421 28742 24679298; CHECK-NEXT:  33721 37784 41979 46042 49981 54044 58239 62302 689 4752 8947 13010 16949 21012 25207 29270299; CHECK-NEXT:  46570 42443 38312 34185 62830 58703 54572 50445 13538 9411 5280 1153 29798 25671 21540 17413300; CHECK-NEXT:  42971 47098 34713 38840 59231 63358 50973 55100 9939 14066 1681 5808 26199 30326 17941 22068301; CHECK-NEXT:  55628 51565 63758 59695 39368 35305 47498 43435 22596 18533 30726 26663 6336 2273 14466 10403302; CHECK-NEXT:  52093 56156 60223 64286 35833 39896 43963 48026 19061 23124 27191 31254 2801 6864 10931 14994303; CHECK-NEXT:  64814 60687 56684 52557 48554 44427 40424 36297 31782 27655 23652 19525 15522 11395 7392 3265304; CHECK-NEXT:  61215 65342 53085 57212 44955 49082 36825 40952 28183 32310 20053 24180 11923 16050 3793 7920305;306entry:307  br label %loop308 309loop:                                              ; preds = %loop, %entry310  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]311  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]312  %crc.shl = shl i16 %crc, 1313  %crc.xor = xor i16 %crc.shl, 4129314  %check.sb = icmp sge i16 %crc, 0315  %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor316  %iv.next = add nuw nsw i32 %iv, 1317  %exit.cond = icmp samesign ult i32 %iv, 7318  br i1 %exit.cond, label %loop, label %exit319 320exit:                                              ; preds = %loop321  ret i16 %crc.next322}323 324define i8 @crc8.be.tc8.ptr.nested.loop(ptr %msg, i32 %loop.limit) {325; CHECK-LABEL: 'crc8.be.tc8.ptr.nested.loop'326; CHECK-NEXT:  Found big-endian CRC-8 loop with trip count 8327; CHECK-NEXT:    Initial CRC: %crc.init = xor i8 %msg.load, %crc.outer328; CHECK-NEXT:    Generating polynomial: 29329; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i8 %crc.xor, i8 %crc.shl330; CHECK-NEXT:    Computed CRC lookup table:331; CHECK-NEXT:  0 29 58 39 116 105 78 83 232 245 210 207 156 129 166 187332; CHECK-NEXT:  205 208 247 234 185 164 131 158 37 56 31 2 81 76 107 118333; CHECK-NEXT:  135 154 189 160 243 238 201 212 111 114 85 72 27 6 33 60334; CHECK-NEXT:  74 87 112 109 62 35 4 25 162 191 152 133 214 203 236 241335; CHECK-NEXT:  19 14 41 52 103 122 93 64 251 230 193 220 143 146 181 168336; CHECK-NEXT:  222 195 228 249 170 183 144 141 54 43 12 17 66 95 120 101337; CHECK-NEXT:  148 137 174 179 224 253 218 199 124 97 70 91 8 21 50 47338; CHECK-NEXT:  89 68 99 126 45 48 23 10 177 172 139 150 197 216 255 226339; CHECK-NEXT:  38 59 28 1 82 79 104 117 206 211 244 233 186 167 128 157340; CHECK-NEXT:  235 246 209 204 159 130 165 184 3 30 57 36 119 106 77 80341; CHECK-NEXT:  161 188 155 134 213 200 239 242 73 84 115 110 61 32 7 26342; CHECK-NEXT:  108 113 86 75 24 5 34 63 132 153 190 163 240 237 202 215343; CHECK-NEXT:  53 40 15 18 65 92 123 102 221 192 231 250 169 180 147 142344; CHECK-NEXT:  248 229 194 223 140 145 182 171 16 13 42 55 100 121 94 67345; CHECK-NEXT:  178 175 136 149 198 219 252 225 90 71 96 125 46 51 20 9346; CHECK-NEXT:  127 98 69 88 11 22 49 44 151 138 173 176 227 254 217 196347;348entry:349  br label %outer.loop350 351outer.loop:                                        ; preds = %inner.exit, %entry352  %crc.outer = phi i8 [ 0, %entry ], [ %crc.next, %inner.exit ]353  %outer.iv = phi i32 [ 0, %entry ], [ %outer.iv.next, %inner.exit ]354  %outer.exit.cond = icmp ult i32 %outer.iv, %loop.limit355  br i1 %outer.exit.cond, label %ph, label %exit356 357ph:                                                ; preds = %outer.loop358  %outer.iv.ext = sext i32 %outer.iv to i64359  %msg.outer.iv = getelementptr inbounds i8, ptr %msg, i64 %outer.iv.ext360  %msg.load = load i8, ptr %msg.outer.iv, align 1361  %crc.init = xor i8 %msg.load, %crc.outer362  br label %inner.loop363 364inner.loop:                                        ; preds = %inner.loop, %ph365  %inner.iv = phi i32 [ 0, %ph ], [ %inner.iv.next, %inner.loop ]366  %crc = phi i8 [ %crc.init, %ph ], [ %crc.next, %inner.loop ]367  %crc.shl = shl i8 %crc, 1368  %crc.xor = xor i8 %crc.shl, 29369  %check.sb = icmp slt i8 %crc, 0370  %crc.next = select i1 %check.sb, i8 %crc.xor, i8 %crc.shl371  %inner.iv.next = add nuw nsw i32 %inner.iv, 1372  %exit.cond = icmp samesign ult i32 %inner.iv, 7373  br i1 %exit.cond, label %inner.loop, label %inner.exit374 375inner.exit:                                        ; preds = %inner.loop376  %outer.iv.next = add i32 %outer.iv, 1377  br label %outer.loop378 379exit:                                              ; preds = %outer.loop380  ret i8 %crc.outer381}382 383define i32 @crc32.le.tc8.data32(i32 %checksum, i32 %msg) {384; CHECK-LABEL: 'crc32.le.tc8.data32'385; CHECK-NEXT:  Found little-endian CRC-32 loop with trip count 8386; CHECK-NEXT:    Initial CRC: i32 %checksum387; CHECK-NEXT:    Generating polynomial: 33800388; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i32 %crc.lshr, i32 %crc.xor389; CHECK-NEXT:    Auxiliary data: i32 %msg390; CHECK-NEXT:    Computed CRC lookup table:391; CHECK-NEXT:  0 4489 8978 12955 17956 22445 25910 29887 35912 40385 44890 48851 51820 56293 59774 63735392; CHECK-NEXT:  4225 264 13203 8730 22181 18220 30135 25662 40137 36160 49115 44626 56045 52068 63999 59510393; CHECK-NEXT:  8450 12427 528 5017 26406 30383 17460 21949 44362 48323 36440 40913 60270 64231 51324 55797394; CHECK-NEXT:  12675 8202 4753 792 30631 26158 21685 17724 48587 44098 40665 36688 64495 60006 55549 51572395; CHECK-NEXT:  16900 21389 24854 28831 1056 5545 10034 14011 52812 57285 60766 64727 34920 39393 43898 47859396; CHECK-NEXT:  21125 17164 29079 24606 5281 1320 14259 9786 57037 53060 64991 60502 39145 35168 48123 43634397; CHECK-NEXT:  25350 29327 16404 20893 9506 13483 1584 6073 61262 65223 52316 56789 43370 47331 35448 39921398; CHECK-NEXT:  29575 25102 20629 16668 13731 9258 5809 1848 65487 60998 56541 52564 47595 43106 39673 35696399; CHECK-NEXT:  33800 38273 42778 46739 49708 54181 57662 61623 2112 6601 11090 15067 20068 24557 28022 31999400; CHECK-NEXT:  38025 34048 47003 42514 53933 49956 61887 57398 6337 2376 15315 10842 24293 20332 32247 27774401; CHECK-NEXT:  42250 46211 34328 38801 58158 62119 49212 53685 10562 14539 2640 7129 28518 32495 19572 24061402; CHECK-NEXT:  46475 41986 38553 34576 62383 57894 53437 49460 14787 10314 6865 2904 32743 28270 23797 19836403; CHECK-NEXT:  50700 55173 58654 62615 32808 37281 41786 45747 19012 23501 26966 30943 3168 7657 12146 16123404; CHECK-NEXT:  54925 50948 62879 58390 37033 33056 46011 41522 23237 19276 31191 26718 7393 3432 16371 11898405; CHECK-NEXT:  59150 63111 50204 54677 41258 45219 33336 37809 27462 31439 18516 23005 11618 15595 3696 8185406; CHECK-NEXT:  63375 58886 54429 50452 45483 40994 37561 33584 31687 27214 22741 18780 15843 11370 7921 3960407;408entry:409  br label %loop410 411loop:                                              ; preds = %loop, %entry412  %crc = phi i32 [ %checksum, %entry ], [ %crc.next, %loop ]413  %data = phi i32 [ %msg, %entry ], [ %data.next, %loop ]414  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]415  %xor.crc.data = xor i32 %crc, %data416  %sb.crc.data = and i32 %xor.crc.data, 1417  %check.sb = icmp eq i32 %sb.crc.data, 0418  %crc.lshr = lshr i32 %crc, 1419  %crc.xor = xor i32 %crc.lshr, 33800420  %crc.next = select i1 %check.sb, i32 %crc.lshr, i32 %crc.xor421  %iv.next = add nuw nsw i8 %iv, 1422  %data.next = lshr i32 %data, 1423  %exit.cond = icmp samesign ult i8 %iv, 7424  br i1 %exit.cond, label %loop, label %exit425 426exit:                                              ; preds = %loop427  ret i32 %crc.next428}429 430define i16 @crc16.be.tc8.zext.data(i8 %msg, i16 %checksum) {431; CHECK-LABEL: 'crc16.be.tc8.zext.data'432; CHECK-NEXT:  Found big-endian CRC-16 loop with trip count 8433; CHECK-NEXT:    Initial CRC: i16 %checksum434; CHECK-NEXT:    Generating polynomial: 258435; CHECK-NEXT:    Computed CRC: %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor436; CHECK-NEXT:    Auxiliary data: i8 %msg437; CHECK-NEXT:    Computed CRC lookup table:438; CHECK-NEXT:  0 258 516 774 1032 1290 1548 1806 2064 2322 2580 2838 3096 3354 3612 3870439; CHECK-NEXT:  4128 4386 4644 4902 5160 5418 5676 5934 6192 6450 6708 6966 7224 7482 7740 7998440; CHECK-NEXT:  8256 8514 8772 9030 9288 9546 9804 10062 10320 10578 10836 11094 11352 11610 11868 12126441; CHECK-NEXT:  12384 12642 12900 13158 13416 13674 13932 14190 14448 14706 14964 15222 15480 15738 15996 16254442; CHECK-NEXT:  16512 16770 17028 17286 17544 17802 18060 18318 18576 18834 19092 19350 19608 19866 20124 20382443; CHECK-NEXT:  20640 20898 21156 21414 21672 21930 22188 22446 22704 22962 23220 23478 23736 23994 24252 24510444; CHECK-NEXT:  24768 25026 25284 25542 25800 26058 26316 26574 26832 27090 27348 27606 27864 28122 28380 28638445; CHECK-NEXT:  28896 29154 29412 29670 29928 30186 30444 30702 30960 31218 31476 31734 31992 32250 32508 32766446; CHECK-NEXT:  33024 32770 33540 33286 34056 33802 34572 34318 35088 34834 35604 35350 36120 35866 36636 36382447; CHECK-NEXT:  37152 36898 37668 37414 38184 37930 38700 38446 39216 38962 39732 39478 40248 39994 40764 40510448; CHECK-NEXT:  41280 41026 41796 41542 42312 42058 42828 42574 43344 43090 43860 43606 44376 44122 44892 44638449; CHECK-NEXT:  45408 45154 45924 45670 46440 46186 46956 46702 47472 47218 47988 47734 48504 48250 49020 48766450; CHECK-NEXT:  49536 49282 50052 49798 50568 50314 51084 50830 51600 51346 52116 51862 52632 52378 53148 52894451; CHECK-NEXT:  53664 53410 54180 53926 54696 54442 55212 54958 55728 55474 56244 55990 56760 56506 57276 57022452; CHECK-NEXT:  57792 57538 58308 58054 58824 58570 59340 59086 59856 59602 60372 60118 60888 60634 61404 61150453; CHECK-NEXT:  61920 61666 62436 62182 62952 62698 63468 63214 63984 63730 64500 64246 65016 64762 65532 65278454;455entry:456  br label %loop457 458loop:                                              ; preds = %loop, %entry459  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]460  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]461  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]462  %data.ext = zext i8 %data to i16463  %xor.crc.data = xor i16 %crc, %data.ext464  %check.sb = icmp sge i16 %xor.crc.data, 0465  %crc.shl = shl i16 %crc, 1466  %crc.xor = xor i16 %crc.shl, 258467  %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor468  %data.next = shl i8 %data, 1469  %iv.next = add nuw nsw i8 %iv, 1470  %exit.cond = icmp samesign ult i8 %iv, 7471  br i1 %exit.cond, label %loop, label %exit472 473exit:                                              ; preds = %loop474  ret i16 %crc.next475}476 477; Negative tests478 479define i16 @not.crc.non.const.tc(i16 %crc.init, i32 %loop.limit) {480; CHECK-LABEL: 'not.crc.non.const.tc'481; CHECK-NEXT:  Did not find a hash algorithm482; CHECK-NEXT:  Reason: Unable to find a small constant byte-multiple trip count483;484entry:485  br label %loop486 487loop:                                              ; preds = %loop, %entry488  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]489  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]490  %crc.shl = shl i16 %crc, 1491  %crc.xor = xor i16 %crc.shl, 4129492  %check.sb = icmp sge i16 %crc, 0493  %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor494  %iv.next = add nuw nsw i32 %iv, 1495  %exit.cond = icmp samesign ult i32 %iv, %loop.limit496  br i1 %exit.cond, label %loop, label %exit497 498exit:                                              ; preds = %loop499  ret i16 %crc.next500}501 502define i16 @not.crc.non.canonical.not.multiple.8(i16 %crc.init) {503; CHECK-LABEL: 'not.crc.non.canonical.not.multiple.8'504; CHECK-NEXT:  Did not find a hash algorithm505; CHECK-NEXT:  Reason: Unable to find a small constant byte-multiple trip count506;507entry:508  br label %loop509 510loop:                                              ; preds = %loop, %entry511  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]512  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]513  %crc.shl = shl i16 %crc, 1514  %crc.xor = xor i16 %crc.shl, 4129515  %check.sb = icmp slt i16 %crc, 0516  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl517  %iv.next = add nuw nsw i32 %iv, 1518  %exit.cond = icmp samesign eq i32 %iv, 3519  br i1 %exit.cond, label %exit, label %loop520 521exit:                                              ; preds = %loop522  ret i16 %crc.next523}524 525define i16 @not.crc.non.canonical.loop.countdown(i16 %crc.init) {526; CHECK-LABEL: 'not.crc.non.canonical.loop.countdown'527; CHECK-NEXT:  Did not find a hash algorithm528; CHECK-NEXT:  Reason: Loop not in canonical form529;530entry:531  br label %loop532 533loop:                                              ; preds = %loop, %entry534  %iv = phi i32 [ 7, %entry ], [ %iv.next, %loop ]535  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]536  %crc.shl = shl i16 %crc, 1537  %crc.xor = xor i16 %crc.shl, 4129538  %check.sb = icmp slt i16 %crc, 0539  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl540  %iv.next = sub nuw nsw i32 %iv, 1541  %exit.cond = icmp samesign eq i32 %iv, 0542  br i1 %exit.cond, label %exit, label %loop543 544exit:                                              ; preds = %loop545  ret i16 %crc.next546}547 548define i16 @not.crc.non.canonical.loop.multiple.blocks(i16 %crc.init) {549; CHECK-LABEL: 'not.crc.non.canonical.loop.multiple.blocks'550; CHECK-NEXT:  Did not find a hash algorithm551; CHECK-NEXT:  Reason: Loop not in canonical form552;553entry:554  br label %loop555 556loop:                                              ; preds = %loop, %entry557  %iv = phi i32 [ 0, %entry ], [ %iv.next, %continue ]558  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %continue ]559  %check.sb = icmp slt i16 %crc, 0560  %crc.shl = shl i16 %crc, 1561  br i1 %check.sb, label %xor, label %continue562 563xor:564  %crc.xor = xor i16 %crc.shl, 4129565  br label %continue566 567continue:568  %crc.next = phi i16 [ %crc.xor, %xor ], [ %crc.shl, %loop ]569  %iv.next = add nuw nsw i32 %iv, 1570  %exit.cond = icmp samesign eq i32 %iv, 7571  br i1 %exit.cond, label %exit, label %loop572 573exit:                                              ; preds = %loop574  ret i16 %crc.next575}576 577define i16 @not.crc.tc.exceeds.data.bw(i16 %crc.init) {578; CHECK-LABEL: 'not.crc.tc.exceeds.data.bw'579; CHECK-NEXT:  Did not find a hash algorithm580; CHECK-NEXT:  Reason: Loop iterations exceed bitwidth of data581;582entry:583  br label %loop584 585loop:                                              ; preds = %loop, %entry586  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]587  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]588  %crc.shl = shl i16 %crc, 1589  %crc.xor = xor i16 %crc.shl, 4129590  %check.sb = icmp slt i16 %crc, 0591  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl592  %iv.next = add nuw nsw i32 %iv, 1593  %exit.cond = icmp samesign ult i32 %iv, 511594  br i1 %exit.cond, label %loop, label %exit595 596exit:                                              ; preds = %loop597  ret i16 %crc.next598}599 600define i16 @not.crc.no.conditional.recurrence(i16 %crc.init) {601; CHECK-LABEL: 'not.crc.no.conditional.recurrence'602; CHECK-NEXT:  Did not find a hash algorithm603; CHECK-NEXT:  Reason: Unable to find conditional recurrence604;605entry:606  br label %loop607 608loop:                                              ; preds = %loop, %entry609  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]610  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]611  %shl = shl i16 %crc, 1612  %crc.next = xor i16 %shl, 258613  %iv.next = add nuw nsw i8 %iv, 1614  %exit.cond = icmp samesign ult i8 %iv, 7615  br i1 %exit.cond, label %loop, label %exit616 617exit:                                              ; preds = %loop618  ret i16 %crc.next619}620 621 622define i16 @not.crc.bad.shift.recurrence(i16 %checksum, i8 %msg) {623; CHECK-LABEL: 'not.crc.bad.shift.recurrence'624; CHECK-NEXT:  Did not find a hash algorithm625; CHECK-NEXT:  Reason: Loop with non-unit bitshifts626;627entry:628  br label %loop629 630loop:                                              ; preds = %loop, %entry631  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]632  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]633  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]634  %crc.lshr = lshr i16 %crc, 8635  %data.ext = zext i8 %data to i16636  %xor.crc.data = xor i16 %crc.lshr, %data.ext637  %check.sb = icmp samesign ult i16 %xor.crc.data, 128638  %crc.and = and i16 %crc, 32767639  %crc.xor = xor i16 %crc.and, 258640  %crc.next = select i1 %check.sb, i16 %crc.and, i16 %crc.xor641  %data.next = shl i8 %data, 1642  %iv.next = add nuw nsw i8 %iv, 1643  %exit.cond = icmp samesign ult i8 %iv, 7644  br i1 %exit.cond, label %loop, label %exit645 646exit:                                              ; preds = %loop647  ret i16 %crc.next648}649 650define i16 @not.crc.nonunit.shifts(i16 %crc.init) {651; CHECK-LABEL: 'not.crc.nonunit.shifts'652; CHECK-NEXT:  Did not find a hash algorithm653; CHECK-NEXT:  Reason: Loop with non-unit bitshifts654;655entry:656  br label %loop657 658loop:                                              ; preds = %loop, %entry659  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]660  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]661  %crc.shl = shl i16 %crc, 2662  %crc.xor = xor i16 %crc.shl, 4129663  %check.sb = icmp slt i16 %crc, 0664  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl665  %iv.next = add nuw nsw i32 %iv, 1666  %exit.cond = icmp samesign ult i32 %iv, 7667  br i1 %exit.cond, label %loop, label %exit668 669exit:                                              ; preds = %loop670  ret i16 %crc.next671}672 673define i16 @not.crc.result.unused(i16 %crc.init) {674; CHECK-LABEL: 'not.crc.result.unused'675; CHECK-NEXT:  Did not find a hash algorithm676; CHECK-NEXT:  Reason: Unable to find use of computed value in loop exit block677;678entry:679  br label %loop680 681loop:                                              ; preds = %loop, %entry682  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]683  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]684  %crc.shl = shl i16 %crc, 1685  %crc.xor = xor i16 %crc.shl, 4129686  %check.sb = icmp slt i16 %crc, 0687  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl688  %iv.next = add nuw nsw i32 %iv, 1689  %exit.cond = icmp samesign ult i32 %iv, 7690  br i1 %exit.cond, label %loop, label %exit691 692exit:                                              ; preds = %loop693  ret i16 %crc694}695 696define i16 @not.crc.wrong.sb.check.const(i8 %msg, i16 %checksum) {697; CHECK-LABEL: 'not.crc.wrong.sb.check.const'698; CHECK-NEXT:  Did not find a hash algorithm699; CHECK-NEXT:  Reason: Malformed significant-bit check700;701entry:702  br label %loop703 704loop:                                              ; preds = %loop, %entry705  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]706  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]707  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]708  %data.ext = zext i8 %data to i16709  %xor.crc.data = xor i16 %crc, %data.ext710  %check.sb = icmp samesign ult i16 %xor.crc.data, 128711  %crc.shl = shl i16 %crc, 1712  %crc.xor = xor i16 %crc.shl, 258713  %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor714  %data.next = shl i8 %data, 1715  %iv.next = add nuw nsw i8 %iv, 1716  %exit.cond = icmp samesign ult i8 %iv, 7717  br i1 %exit.cond, label %loop, label %exit718 719exit:                                              ; preds = %loop720  ret i16 %crc.next721}722 723define i16 @not.crc.wrong.sb.check.pred(i16 %crc.init) {724; CHECK-LABEL: 'not.crc.wrong.sb.check.pred'725; CHECK-NEXT:  Did not find a hash algorithm726; CHECK-NEXT:  Reason: Malformed significant-bit check727;728entry:729  br label %loop730 731loop:                                              ; preds = %loop, %entry732  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]733  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]734  %crc.shl = shl i16 %crc, 1735  %crc.xor = xor i16 %crc.shl, 4129736  %check.sb = icmp sgt i16 %crc, 0737  %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor738  %iv.next = add nuw nsw i32 %iv, 1739  %exit.cond = icmp samesign ult i32 %iv, 7740  br i1 %exit.cond, label %loop, label %exit741 742exit:                                              ; preds = %loop743  ret i16 %crc.next744}745 746define i16 @not.crc.excess.tc(i8 %msg, i16 %checksum) {747; CHECK-LABEL: 'not.crc.excess.tc'748; CHECK-NEXT:  Did not find a hash algorithm749; CHECK-NEXT:  Reason: Loop iterations exceed bitwidth of data750;751entry:752  br label %loop753 754loop:                                              ; preds = %loop, %entry755  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]756  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]757  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]758  %crc.trunc = trunc i16 %crc to i8759  %xor.crc.data = xor i8 %crc.trunc, %data760  %and.crc.data = and i8 %xor.crc.data, 1761  %data.next = lshr i8 %data, 1762  %check.sb = icmp eq i8 %and.crc.data, 0763  %crc.lshr = lshr i16 %crc, 1764  %crc.xor = xor i16 %crc.lshr, -24575765  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor766  %iv.next = add nuw nsw i8 %iv, 1767  %exit.cond = icmp samesign ult i8 %iv, 15768  br i1 %exit.cond, label %loop, label %exit769 770exit:                                              ; preds = %loop771  ret i16 %crc.next772}773 774define i16 @not.crc.init.arg.excess.tc(i16 %crc.init) {775; CHECK-LABEL: 'not.crc.init.arg.excess.tc'776; CHECK-NEXT:  Did not find a hash algorithm777; CHECK-NEXT:  Reason: Loop iterations exceed bitwidth of data778;779entry:780  br label %loop781 782loop:                                              ; preds = %loop, %entry783  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]784  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]785  %crc.shl = shl i16 %crc, 1786  %crc.xor = xor i16 %crc.shl, 4129787  %check.sb = icmp slt i16 %crc, 0788  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl789  %iv.next = add nuw nsw i32 %iv, 1790  %exit.cond = icmp samesign ult i32 %iv, 31791  br i1 %exit.cond, label %loop, label %exit792 793exit:                                              ; preds = %loop794  ret i16 %crc.next795}796 797define i32 @not.crc.unknown.icmp.rhs(i32 %checksum, i32 %msg, i32 %unknown) {798; CHECK-LABEL: 'not.crc.unknown.icmp.rhs'799; CHECK-NEXT:  Did not find a hash algorithm800; CHECK-NEXT:  Reason: Malformed significant-bit check801;802entry:803  br label %loop804 805loop:                                              ; preds = %loop, %entry806  %crc = phi i32 [ %checksum, %entry ], [ %crc.next, %loop ]807  %data = phi i32 [ %msg, %entry ], [ %data.next, %loop ]808  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]809  %xor.crc.data = xor i32 %crc, %data810  %sb.crc.data = or i32 %xor.crc.data, 1811  %check.sb = icmp eq i32 %sb.crc.data, %unknown812  %crc.lshr = lshr i32 %crc, 1813  %crc.xor = xor i32 %crc.lshr, 33800814  %crc.next = select i1 %check.sb, i32 %crc.lshr, i32 %crc.xor815  %iv.next = add nuw nsw i8 %iv, 1816  %data.next = lshr i32 %data, 1817  %exit.cond = icmp samesign ult i8 %iv, 7818  br i1 %exit.cond, label %loop, label %exit819 820exit:                                              ; preds = %loop821  ret i32 %crc.next822}823 824define i32 @not.crc.unknown.icmp.lhs(i32 %checksum, i32 %msg, i32 %unknown) {825; CHECK-LABEL: 'not.crc.unknown.icmp.lhs'826; CHECK-NEXT:  Did not find a hash algorithm827; CHECK-NEXT:  Reason: Malformed significant-bit check828;829entry:830  br label %loop831 832loop:                                              ; preds = %loop, %entry833  %crc = phi i32 [ %checksum, %entry ], [ %crc.next, %loop ]834  %data = phi i32 [ %msg, %entry ], [ %data.next, %loop ]835  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]836  %xor.crc.data = xor i32 %crc, %data837  %sb.crc.data = or i32 %xor.crc.data, %unknown838  %check.sb = icmp eq i32 %sb.crc.data, 0839  %crc.lshr = lshr i32 %crc, 1840  %crc.xor = xor i32 %crc.lshr, 33800841  %crc.next = select i1 %check.sb, i32 %crc.lshr, i32 %crc.xor842  %iv.next = add nuw nsw i8 %iv, 1843  %data.next = lshr i32 %data, 1844  %exit.cond = icmp samesign ult i8 %iv, 7845  br i1 %exit.cond, label %loop, label %exit846 847exit:                                              ; preds = %loop848  ret i32 %crc.next849}850 851 852define i16 @not.crc.stray.or(i16 %msg, i16 %checksum) {853; CHECK-LABEL: 'not.crc.stray.or'854; CHECK-NEXT:  Did not find a hash algorithm855; CHECK-NEXT:  Reason: Malformed significant-bit check856;857entry:858  br label %loop859 860loop:                                              ; preds = %loop, %entry861  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]862  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]863  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]864  %xor.crc.data = xor i16 %crc, %data865  %and.crc.data = and i16 %xor.crc.data, 1866  %crc.corrupt = or i16 %and.crc.data, 1867  %data.next = lshr i16 %data, 1868  %check.sb = icmp ne i16 %crc.corrupt, 0869  %crc.lshr = lshr i16 %crc, 1870  %crc.xor = xor i16 %crc.lshr, -24575871  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor872  %iv.next = add nuw nsw i8 %iv, 1873  %exit.cond = icmp samesign ult i8 %iv, 15874  br i1 %exit.cond, label %loop, label %exit875 876exit:                                              ; preds = %loop877  ret i16 %crc.next878}879 880define i16 @not.crc.inverse.sb.check(i16 %msg, i16 %checksum) {881; CHECK-LABEL: 'not.crc.inverse.sb.check'882; CHECK-NEXT:  Did not find a hash algorithm883; CHECK-NEXT:  Reason: Malformed significant-bit check884;885entry:886  br label %loop887 888loop:                                              ; preds = %loop, %entry889  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]890  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]891  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]892  %xor.crc.data = xor i16 %crc, %data893  %and.crc.data = and i16 %xor.crc.data, 1894  %data.next = lshr i16 %data, 1895  %check.sb = icmp ne i16 %and.crc.data, 0896  %crc.lshr = lshr i16 %crc, 1897  %crc.xor = xor i16 %crc.lshr, -24575898  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor899  %iv.next = add nuw nsw i8 %iv, 1900  %exit.cond = icmp samesign ult i8 %iv, 15901  br i1 %exit.cond, label %loop, label %exit902 903exit:                                              ; preds = %loop904  ret i16 %crc.next905}906 907define i16 @not.crc.sb.check.endian.mismatch(i8 %msg, i16 %checksum) {908; CHECK-LABEL: 'not.crc.sb.check.endian.mismatch'909; CHECK-NEXT:  Did not find a hash algorithm910; CHECK-NEXT:  Reason: Malformed significant-bit check911;912entry:913  br label %loop914 915loop:                                              ; preds = %loop, %entry916  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]917  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]918  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]919  %crc.trunc = trunc i16 %crc to i8920  %xor.data.crc = xor i8 %data, %crc.trunc921  %and.data.crc = and i8 %xor.data.crc, 1922  %data.next = mul i8 %data, 2923  %check.sb = icmp eq i8 %and.data.crc, 0924  %crc.lshr = mul i16 %crc, 2925  %xor = xor i16 %crc.lshr, 0926  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor927  %iv.next = add nuw nsw i8 %iv, 1928  %exit.cond = icmp samesign ult i8 %iv, 7929  br i1 %exit.cond, label %loop, label %exit930 931exit:                                              ; preds = %loop932  ret i16 %crc.next933}934 935define i16 @not.crc.init.arg.inverted.select(i16 %crc.init) {936; CHECK-LABEL: 'not.crc.init.arg.inverted.select'937; CHECK-NEXT:  Did not find a hash algorithm938; CHECK-NEXT:  Reason: Malformed significant-bit check939;940entry:941  br label %loop942 943loop:                                              ; preds = %loop, %entry944  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]945  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]946  %sb.crc = and i16 %crc, 1947  %check.sb = icmp eq i16 %sb.crc, 0948  %crc.lshr = lshr i16 %crc, 1949  %crc.xor = xor i16 %crc.lshr, -24575950  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.lshr951  %iv.next = add nuw nsw i8 %iv, 1952  %exit.cond = icmp samesign ult i8 %iv, 7953  br i1 %exit.cond, label %loop, label %exit954 955exit:                                              ; preds = %loop956  ret i16 %crc.next957}958 959define i16 @not.crc.bad.endian.swapped.sb.check(i8 %msg, i16 %checksum) {960; CHECK-LABEL: 'not.crc.bad.endian.swapped.sb.check'961; CHECK-NEXT:  Did not find a hash algorithm962; CHECK-NEXT:  Reason: Malformed significant-bit check963;964entry:965  br label %loop966 967loop:                                              ; preds = %loop, %entry968  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]969  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]970  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]971  %data.ext = zext i8 %data to i16972  %xor.crc.data = xor i16 %crc, %data.ext973  %check.sb = icmp slt i16 %xor.crc.data, 0974  %crc.shl = shl i16 %crc, 1975  %crc.xor = xor i16 %crc.shl, 29976  %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor977  %data.next = shl i8 %data, 1978  %iv.next = add nuw nsw i8 %iv, 1979  %exit.cond = icmp samesign ult i8 %iv, 7980  br i1 %exit.cond, label %loop, label %exit981 982exit:                                              ; preds = %loop983  ret i16 %crc.next984}985 986define i32 @not.crc.dead.msg.bad.use(i32 %checksum, i32 %msg) {987; CHECK-LABEL: 'not.crc.dead.msg.bad.use'988; CHECK-NEXT:  Did not find a hash algorithm989; CHECK-NEXT:  Reason: Recurrences not intertwined with XOR990;991entry:992  br label %loop993 994loop:                                              ; preds = %loop, %entry995  %crc = phi i32 [ %checksum, %entry ], [ %crc.next, %loop ]996  %data = phi i32 [ %msg, %entry ], [ %data.next, %loop ]997  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]998  %data.or = or i32 %data, -1999  %xor.crc.data = xor i32 %crc, %data.or1000  %sb.crc.data = and i32 %xor.crc.data, 11001  %check.sb = icmp eq i32 %sb.crc.data, 01002  %crc.lshr = lshr i32 %crc, 11003  %crc.xor = xor i32 %crc.lshr, 338001004  %crc.next = select i1 %check.sb, i32 %crc.lshr, i32 %crc.xor1005  %iv.next = add nuw nsw i8 %iv, 11006  %data.next = lshr i32 %data, 11007  %exit.cond = icmp samesign ult i8 %iv, 71008  br i1 %exit.cond, label %loop, label %exit1009 1010exit:                                              ; preds = %loop1011  ret i32 %crc.next1012}1013 1014define i16 @not.crc.dead.msg.no.use(i8 %msg, i16 %checksum) {1015; CHECK-LABEL: 'not.crc.dead.msg.no.use'1016; CHECK-NEXT:  Did not find a hash algorithm1017; CHECK-NEXT:  Reason: Recurrences have stray uses1018;1019entry:1020  br label %loop1021 1022loop:                                              ; preds = %loop, %entry1023  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1024  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1025  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]1026  %crc.trunc = trunc i16 %crc to i81027  %and.crc = and i8 %crc.trunc, 11028  %data.next = lshr i8 %data, 11029  %check.sb = icmp eq i8 %and.crc, 01030  %crc.lshr = lshr i16 %crc, 11031  %xor = xor i16 %crc.lshr, -245751032  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor1033  %iv.next = add nuw nsw i8 %iv, 11034  %exit.cond = icmp samesign ult i8 %iv, 71035  br i1 %exit.cond, label %loop, label %exit1036 1037exit:                                              ; preds = %loop1038  %data.zext = zext i8 %data.next to i161039  %ret = xor i16 %crc.next, %data.zext1040  ret i16 %ret1041}1042 1043define i32 @not.crc.dead.msg.wrong.op(i32 %checksum, i32 %msg) {1044; CHECK-LABEL: 'not.crc.dead.msg.wrong.op'1045; CHECK-NEXT:  Did not find a hash algorithm1046; CHECK-NEXT:  Reason: Recurrences not intertwined with XOR1047;1048entry:1049  br label %loop1050 1051loop:                                              ; preds = %loop, %entry1052  %crc = phi i32 [ %checksum, %entry ], [ %crc.next, %loop ]1053  %data = phi i32 [ %msg, %entry ], [ %data.next, %loop ]1054  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1055  %or.crc.data = or i32 %crc, %data1056  %sb.crc.data = and i32 %or.crc.data, 11057  %check.sb = icmp eq i32 %sb.crc.data, 01058  %crc.lshr = lshr i32 %crc, 11059  %crc.xor = xor i32 %crc.lshr, 338001060  %crc.next = select i1 %check.sb, i32 %crc.lshr, i32 %crc.xor1061  %iv.next = add nuw nsw i8 %iv, 11062  %data.next = lshr i32 %data, 11063  %exit.cond = icmp samesign ult i8 %iv, 71064  br i1 %exit.cond, label %loop, label %exit1065 1066exit:                                              ; preds = %loop1067  ret i32 %crc.next1068}1069 1070define i16 @not.crc.dead.msg.xor.notin.select.chain(i16 %msg, i16 %checksum) {1071; CHECK-LABEL: 'not.crc.dead.msg.xor.notin.select.chain'1072; CHECK-NEXT:  Did not find a hash algorithm1073; CHECK-NEXT:  Reason: Recurrences have stray uses1074;1075entry:1076  br label %loop1077 1078loop:                                              ; preds = %loop, %entry1079  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1080  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1081  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]1082  %xor.crc.data = xor i16 %crc, %data1083  %or.crc.data = or i16 %crc, %data1084  %and.crc.data = and i16 %or.crc.data, 11085  %data.next = lshr i16 %data, 11086  %check.sb = icmp eq i16 %and.crc.data, 01087  %crc.lshr = lshr i16 %crc, 11088  %crc.xor = xor i16 %crc.lshr, -245751089  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor1090  %iv.next = add nuw nsw i8 %iv, 11091  %exit.cond = icmp samesign ult i8 %iv, 151092  br i1 %exit.cond, label %loop, label %exit1093 1094exit:                                              ; preds = %loop1095  ret i16 %crc.next1096}1097 1098define i16 @not.crc.bad.xor.crc.data(i16 %msg, i16 %checksum) {1099; CHECK-LABEL: 'not.crc.bad.xor.crc.data'1100; CHECK-NEXT:  Did not find a hash algorithm1101; CHECK-NEXT:  Reason: Recurrences have stray uses1102;1103entry:1104  br label %loop1105 1106loop:                                              ; preds = %loop, %entry1107  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1108  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1109  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]1110  %xor.crc.data = xor i16 %crc, %data1111  %mul.corrupt = mul i16 %xor.crc.data, 01112  %xor.crc.data.corrupt = xor i16 %mul.corrupt, %crc1113  %and.crc.data = and i16 %xor.crc.data.corrupt, 11114  %data.next = lshr i16 %data, 11115  %check.sb = icmp eq i16 %and.crc.data, 01116  %crc.lshr = lshr i16 %crc, 11117  %crc.xor = xor i16 %crc.lshr, -245751118  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor1119  %iv.next = add nuw nsw i8 %iv, 11120  %exit.cond = icmp samesign ult i8 %iv, 151121  br i1 %exit.cond, label %loop, label %exit1122 1123exit:                                              ; preds = %loop1124  ret i16 %crc.next1125}1126 1127define i16 @not.crc.dead.msg.or.zero(i16 %msg, i16 %checksum) {1128; CHECK-LABEL: 'not.crc.dead.msg.or.zero'1129; CHECK-NEXT:  Did not find a hash algorithm1130; CHECK-NEXT:  Reason: Recurrences have stray uses1131;1132entry:1133  br label %loop1134 1135loop:                                              ; preds = %loop, %entry1136  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1137  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1138  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]1139  %xor.crc.data = xor i16 %crc, %data1140  %mul.corrupt = mul i16 %xor.crc.data, 01141  %or.crc.data.corrupt = or i16 %mul.corrupt, %crc1142  %and.crc.data = and i16 %or.crc.data.corrupt, 11143  %data.next = lshr i16 %data, 11144  %check.sb = icmp eq i16 %and.crc.data, 01145  %crc.lshr = lshr i16 %crc, 11146  %crc.xor = xor i16 %crc.lshr, -245751147  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor1148  %iv.next = add nuw nsw i8 %iv, 11149  %exit.cond = icmp samesign ult i8 %iv, 151150  br i1 %exit.cond, label %loop, label %exit1151 1152exit:                                              ; preds = %loop1153  ret i16 %crc.next1154}1155 1156define i16 @not.crc.unknown.value(i16 %msg, i16 %checksum, i16 %corrupt) {1157; CHECK-LABEL: 'not.crc.unknown.value'1158; CHECK-NEXT:  Did not find a hash algorithm1159; CHECK-NEXT:  Reason: Malformed significant-bit check1160;1161entry:1162  br label %loop1163 1164loop:                                              ; preds = %loop, %entry1165  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1166  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1167  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]1168  %xor.crc.data = xor i16 %crc, %data1169  %xor.crc.data.corrupt = mul i16 %xor.crc.data, %corrupt1170  %and.crc.data = and i16 %xor.crc.data.corrupt, 11171  %data.next = lshr i16 %data, 11172  %check.sb = icmp eq i16 %and.crc.data, 01173  %crc.lshr = lshr i16 %crc, 11174  %crc.xor = xor i16 %crc.lshr, -245751175  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor1176  %iv.next = add nuw nsw i8 %iv, 11177  %exit.cond = icmp samesign ult i8 %iv, 151178  br i1 %exit.cond, label %loop, label %exit1179 1180exit:                                              ; preds = %loop1181  ret i16 %crc.next1182}1183 1184define i16 @not.crc.unknown.call.outside.loop(i16 %msg, i16 %checksum) {1185; CHECK-LABEL: 'not.crc.unknown.call.outside.loop'1186; CHECK-NEXT:  Did not find a hash algorithm1187; CHECK-NEXT:  Reason: Malformed significant-bit check1188;1189entry:1190  %corrupt = call i16 @side.effect()1191  br label %loop1192 1193loop:                                              ; preds = %loop, %entry1194  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1195  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1196  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]1197  %xor.crc.data = xor i16 %crc, %data1198  %xor.crc.data.corrupt = mul i16 %xor.crc.data, %corrupt1199  %and.crc.data = and i16 %xor.crc.data.corrupt, 11200  %data.next = lshr i16 %data, 11201  %check.sb = icmp eq i16 %and.crc.data, 01202  %crc.lshr = lshr i16 %crc, 11203  %crc.xor = xor i16 %crc.lshr, -245751204  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor1205  %iv.next = add nuw nsw i8 %iv, 11206  %exit.cond = icmp samesign ult i8 %iv, 151207  br i1 %exit.cond, label %loop, label %exit1208 1209exit:                                              ; preds = %loop1210  ret i16 %crc.next1211}1212 1213define i16 @not.crc.constant.sb.check.corruption(i16 %msg, i16 %checksum) {1214; CHECK-LABEL: 'not.crc.constant.sb.check.corruption'1215; CHECK-NEXT:  Did not find a hash algorithm1216; CHECK-NEXT:  Reason: Malformed significant-bit check1217;1218entry:1219  br label %loop1220 1221loop:                                              ; preds = %loop, %entry1222  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1223  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1224  %data = phi i16 [ %msg, %entry ], [ %data.next, %loop ]1225  %xor.crc.data = xor i16 %crc, %data1226  %xor.crc.data.corrupt = mul i16 %xor.crc.data, 21227  %and.crc.data = and i16 %xor.crc.data.corrupt, 11228  %data.next = lshr i16 %data, 11229  %check.sb = icmp eq i16 %and.crc.data, 01230  %crc.lshr = lshr i16 %crc, 11231  %crc.xor = xor i16 %crc.lshr, -245751232  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %crc.xor1233  %iv.next = add nuw nsw i8 %iv, 11234  %exit.cond = icmp samesign ult i8 %iv, 151235  br i1 %exit.cond, label %loop, label %exit1236 1237exit:                                              ; preds = %loop1238  ret i16 %crc.next1239}1240 1241define i16 @not.crc.float.simple.recurrence(float %msg, i16 %checksum) {1242; CHECK-LABEL: 'not.crc.float.simple.recurrence'1243; CHECK-NEXT:  Did not find a hash algorithm1244; CHECK-NEXT:  Reason: Loop with non-unit bitshifts1245;1246entry:1247  br label %loop1248 1249loop:                                              ; preds = %loop, %entry1250  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1251  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1252  %data = phi float [ %msg, %entry ], [ %data.next, %loop ]1253  %crc.conv = sitofp i16 %crc to float1254  %frem.data.crc = frem float %data, %crc.conv1255  %and.data.crc = fdiv float %frem.data.crc, 2.01256  %data.next = fdiv float %data, 2.01257  %check.sb = fcmp oeq float %and.data.crc, 0.01258  %crc.lshr = lshr i16 %crc, 11259  %xor = xor i16 %crc.lshr, -245751260  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor1261  %iv.next = add nuw nsw i8 %iv, 11262  %exit.cond = icmp samesign ult i8 %iv, 71263  br i1 %exit.cond, label %loop, label %exit1264 1265exit:                                              ; preds = %loop1266  ret i16 %crc.next1267}1268 1269define i16 @not.crc.stray.phi(i8 %msg, i16 %checksum, i1 %c) {1270; CHECK-LABEL: 'not.crc.stray.phi'1271; CHECK-NEXT:  Did not find a hash algorithm1272; CHECK-NEXT:  Reason: Found stray PHI1273;1274entry:1275  br label %loop1276 1277loop:                                              ; preds = %loop, %entry1278  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1279  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1280  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]1281  %crc.trunc = trunc i16 %crc to i81282  %xor.data.crc = xor i8 %data, %crc.trunc1283  %and.data.crc = and i8 %xor.data.crc, 11284  %data.next = select i1 %c, i8 %data, i8 11285  %check.sb = icmp eq i8 %and.data.crc, 01286  %crc.lshr = lshr i16 %crc, 11287  %xor = xor i16 %crc.lshr, -245751288  %crc.next = select i1 %check.sb, i16 %crc.lshr, i16 %xor1289  %iv.next = add nuw nsw i8 %iv, 11290  %exit.cond = icmp samesign ult i8 %iv, 71291  br i1 %exit.cond, label %loop, label %exit1292 1293exit:                                              ; preds = %loop1294  ret i16 %crc.next1295}1296 1297define i16 @not.crc.stray.unvisited.call(i16 %crc.init) {1298; CHECK-LABEL: 'not.crc.stray.unvisited.call'1299; CHECK-NEXT:  Did not find a hash algorithm1300; CHECK-NEXT:  Reason: Found stray unvisited instructions1301;1302entry:1303  br label %loop1304 1305loop:                                              ; preds = %loop, %entry1306  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]1307  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1308  %crc.shl = shl i16 %crc, 11309  %crc.xor = xor i16 %crc.shl, 41291310  %check.sb = icmp slt i16 %crc, 01311  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl1312  call void @print(i16 %crc.next)1313  %iv.next = add nuw nsw i32 %iv, 11314  %exit.cond = icmp samesign ult i32 %iv, 71315  br i1 %exit.cond, label %loop, label %exit1316 1317exit:                                              ; preds = %loop1318  ret i16 %crc.next1319}1320 1321declare void @print(i16)1322 1323define i16 @not.crc.call.sb.check(i16 %crc.init) {1324; CHECK-LABEL: 'not.crc.call.sb.check'1325; CHECK-NEXT:  Did not find a hash algorithm1326; CHECK-NEXT:  Reason: Malformed significant-bit check1327;1328entry:1329  br label %loop1330 1331loop:                                              ; preds = %loop, %entry1332  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]1333  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1334  %crc.shl = shl i16 %crc, 11335  %crc.xor = xor i16 %crc.shl, 41291336  %call = call i16 @side.effect()1337  %check.sb = icmp slt i16 %call, 01338  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl1339  %iv.next = add nuw nsw i32 %iv, 11340  %exit.cond = icmp samesign ult i32 %iv, 71341  br i1 %exit.cond, label %loop, label %exit1342 1343exit:                                              ; preds = %loop1344  ret i16 %crc.next1345}1346 1347define i16 @not.crc.bad.lhs.sb.check.be(i16 %crc.init) {1348; CHECK-LABEL: 'not.crc.bad.lhs.sb.check.be'1349; CHECK-NEXT:  Did not find a hash algorithm1350; CHECK-NEXT:  Reason: Malformed significant-bit check1351;1352entry:1353  br label %loop1354 1355loop:                                              ; preds = %loop, %entry1356  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]1357  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1358  %crc.shl = shl i16 %crc, 11359  %crc.xor = xor i16 %crc.shl, 41291360  %check.sb = icmp slt i16 %crc.shl, 01361  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl1362  %iv.next = add nuw nsw i32 %iv, 11363  %exit.cond = icmp samesign ult i32 %iv, 71364  br i1 %exit.cond, label %loop, label %exit1365 1366exit:                                              ; preds = %loop1367  ret i16 %crc.next1368}1369 1370define i16 @not.crc.bad.cast.sext(i8 %msg, i16 %checksum) {1371; CHECK-LABEL: 'not.crc.bad.cast.sext'1372; CHECK-NEXT:  Did not find a hash algorithm1373; CHECK-NEXT:  Reason: Recurrences not intertwined with XOR1374;1375entry:1376  br label %loop1377 1378loop:                                              ; preds = %loop, %entry1379  %iv = phi i8 [ 0, %entry ], [ %iv.next, %loop ]1380  %data = phi i8 [ %msg, %entry ], [ %data.next, %loop ]1381  %crc = phi i16 [ %checksum, %entry ], [ %crc.next, %loop ]1382  %data.ext = sext i8 %data to i161383  %xor.crc.data = xor i16 %crc, %data.ext1384  %check.sb = icmp sge i16 %xor.crc.data, 01385  %crc.shl = shl i16 %crc, 11386  %crc.xor = xor i16 %crc.shl, 2581387  %crc.next = select i1 %check.sb, i16 %crc.shl, i16 %crc.xor1388  %data.next = shl i8 %data, 11389  %iv.next = add nuw nsw i8 %iv, 11390  %exit.cond = icmp samesign ult i8 %iv, 71391  br i1 %exit.cond, label %loop, label %exit1392 1393exit:                                              ; preds = %loop1394  ret i16 %crc.next1395}1396 1397 1398define i16 @not.crc.sb.check.patternmatch.fail(i16 %crc.init) {1399; CHECK-LABEL: 'not.crc.sb.check.patternmatch.fail'1400; CHECK-NEXT:  Did not find a hash algorithm1401; CHECK-NEXT:  Reason: Malformed significant-bit check1402;1403entry:1404  br label %loop1405 1406loop:                                              ; preds = %loop, %entry1407  %iv = phi i16 [ 0, %entry ], [ %iv.next, %loop ]1408  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1409  %crc.shl = shl i16 %crc, 11410  %evil.and.iv = and i16 %iv, 21411  %evil.and.1 = add i16 %evil.and.iv, 11412  %evil.mul = mul i16 %crc.shl, %evil.and.11413  %evil.xor = xor i16 %evil.mul, 41291414  %check.sb = icmp slt i16 %crc, 01415  %crc.next = select i1 %check.sb, i16 %evil.xor, i16 %evil.mul1416  %iv.next = add nuw nsw i16 %iv, 11417  %exitcond.not = icmp eq i16 %iv.next, 81418  br i1 %exitcond.not, label %exit, label %loop1419 1420exit:                                              ; preds = %loop1421  ret i16 %crc.next1422}1423 1424define i16 @not.crc.sb.check.patternmatch.fail.call.outside.loop(i16 %crc.init) {1425; CHECK-LABEL: 'not.crc.sb.check.patternmatch.fail.call.outside.loop'1426; CHECK-NEXT:  Did not find a hash algorithm1427; CHECK-NEXT:  Reason: Malformed significant-bit check1428;1429entry:1430  %corrupt = call i16 @side.effect()1431  br label %loop1432 1433loop:                                              ; preds = %loop, %entry1434  %iv = phi i16 [ 0, %entry ], [ %iv.next, %loop ]1435  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1436  %crc.shl = shl i16 %crc, 11437  %evil.and.corrupt = and i16 %corrupt, 21438  %evil.and.1 = add i16 %evil.and.corrupt, 11439  %evil.mul = mul i16 %crc.shl, %evil.and.11440  %evil.xor = xor i16 %evil.mul, 41291441  %check.sb = icmp slt i16 %crc, 01442  %crc.next = select i1 %check.sb, i16 %evil.xor, i16 %evil.mul1443  %iv.next = add nuw nsw i16 %iv, 11444  %exitcond.not = icmp eq i16 %iv.next, 81445  br i1 %exitcond.not, label %exit, label %loop1446 1447exit:                                              ; preds = %loop1448  ret i16 %crc.next1449}1450 1451define i16 @not.crc.data.next.outside.user(i16 %crc.init, i16 %data.init) {1452; CHECK-LABEL: 'not.crc.data.next.outside.user'1453; CHECK-NEXT:  Did not find a hash algorithm1454; CHECK-NEXT:  Reason: Recurrences have stray uses1455;1456entry:1457  br label %loop1458 1459loop:1460  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]1461  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1462  %data = phi i16 [ %data.init, %entry ], [ %data.next, %loop ]1463  %xor.crc.data = xor i16 %data, %crc1464  %crc.shl = shl i16 %crc, 11465  %crc.xor = xor i16 %crc.shl, 31466  %check.sb = icmp slt i16 %xor.crc.data, 01467  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl1468  %data.next = shl i16 %data, 11469  %iv.next = add nuw nsw i32 %iv, 11470  %exit.cond = icmp samesign ult i32 %iv, 71471  br i1 %exit.cond, label %loop, label %exit1472 1473exit:1474  %ret = xor i16 %data.next, %crc.next1475  ret i16 %ret1476}1477 1478define i16 @not.crc.data.phi.outside.user(i16 %crc.init, i16 %data.init) {1479; CHECK-LABEL: 'not.crc.data.phi.outside.user'1480; CHECK-NEXT:  Did not find a hash algorithm1481; CHECK-NEXT:  Reason: Recurrences have stray uses1482;1483entry:1484  br label %loop1485 1486loop:1487  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]1488  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1489  %data = phi i16 [ %data.init, %entry ], [ %data.next, %loop ]1490  %xor.crc.data = xor i16 %data, %crc1491  %crc.shl = shl i16 %crc, 11492  %crc.xor = xor i16 %crc.shl, 31493  %check.sb = icmp slt i16 %xor.crc.data, 01494  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl1495  %data.next = shl i16 %data, 11496  %iv.next = add nuw nsw i32 %iv, 11497  %exit.cond = icmp samesign ult i32 %iv, 71498  br i1 %exit.cond, label %loop, label %exit1499 1500exit:1501  %ret = xor i16 %data, %crc.next1502  ret i16 %ret1503}1504 1505define i16 @not.crc.crc.phi.outside.user(i16 %crc.init, i16 %data.init) {1506; CHECK-LABEL: 'not.crc.crc.phi.outside.user'1507; CHECK-NEXT:  Did not find a hash algorithm1508; CHECK-NEXT:  Reason: Recurrences have stray uses1509;1510entry:1511  br label %loop1512 1513loop:1514  %iv = phi i32 [ 0, %entry ], [ %iv.next, %loop ]1515  %crc = phi i16 [ %crc.init, %entry ], [ %crc.next, %loop ]1516  %data = phi i16 [ %data.init, %entry ], [ %data.next, %loop ]1517  %xor.crc.data = xor i16 %data, %crc1518  %crc.shl = shl i16 %crc, 11519  %crc.xor = xor i16 %crc.shl, 31520  %check.sb = icmp slt i16 %xor.crc.data, 01521  %crc.next = select i1 %check.sb, i16 %crc.xor, i16 %crc.shl1522  %data.next = shl i16 %data, 11523  %iv.next = add nuw nsw i32 %iv, 11524  %exit.cond = icmp samesign ult i32 %iv, 71525  br i1 %exit.cond, label %loop, label %exit1526 1527exit:1528  %ret = xor i16 %crc, %crc.next1529  ret i16 %ret1530}1531 1532declare i16 @side.effect()1533