Print this page
new smatch

Split Close
Expand all
Collapse all
          --- old/usr/src/tools/smatch/src/validation/optim/bool-simplify.c
          +++ new/usr/src/tools/smatch/src/validation/optim/bool-simplify.c
↓ open down ↓ 10 lines elided ↑ open up ↑
  11   11  int or_0(int a)
  12   12  {
  13   13          return a || 0;
  14   14  }
  15   15  
  16   16  int or_1(int a)
  17   17  {
  18   18          return a || 1;
  19   19  }
  20   20  
       21 +// try again but with something true but != 1
       22 +int and_2(int a)
       23 +{
       24 +        return a && 2;
       25 +}
       26 +
       27 +int or_2(int a)
       28 +{
       29 +        return a || 2;
       30 +}
       31 +
  21   32  /*
  22   33   * check-name: bool-simplify
  23   34   * check-command: test-linearize -Wno-decl $file
  24   35   *
  25   36   * check-output-start
  26   37  and_0:
  27   38  .L0:
  28   39          <entry-point>
  29   40          ret.32      $0
  30   41  
  31   42  
  32   43  and_1:
  33   44  .L2:
  34   45          <entry-point>
  35      -        setne.1     %r8 <- %arg1, $0
  36      -        cast.32     %r11 <- (1) %r8
  37      -        ret.32      %r11
       46 +        setne.32    %r9 <- %arg1, $0
       47 +        ret.32      %r9
  38   48  
  39   49  
  40   50  or_0:
  41   51  .L4:
  42   52          <entry-point>
  43      -        setne.1     %r14 <- %arg1, $0
  44      -        cast.32     %r17 <- (1) %r14
  45      -        ret.32      %r17
       53 +        setne.32    %r14 <- %arg1, $0
       54 +        ret.32      %r14
  46   55  
  47   56  
  48   57  or_1:
  49   58  .L6:
  50   59          <entry-point>
  51   60          ret.32      $1
       61 +
       62 +
       63 +and_2:
       64 +.L8:
       65 +        <entry-point>
       66 +        setne.32    %r25 <- %arg1, $0
       67 +        ret.32      %r25
       68 +
       69 +
       70 +or_2:
       71 +.L10:
       72 +        <entry-point>
       73 +        ret.32      $1
  52   74  
  53   75  
  54   76   * check-output-end
  55   77   */
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX