llvm-6502/lib/Transforms
Chris Lattner 61c77449c7 fix a fairly serious oversight with switch formation from
or'd conditions.  Previously we'd compile something like this:

int crud (unsigned char c) {
   return c == 62 || c == 34 || c == 92;
}

into:

  switch i8 %c, label %lor.rhs [
    i8 62, label %lor.end
    i8 34, label %lor.end
  ]

lor.rhs:                                          ; preds = %entry
  %cmp8 = icmp eq i8 %c, 92
  br label %lor.end

lor.end:                                          ; preds = %entry, %entry, %lor.rhs
  %0 = phi i1 [ true, %entry ], [ %cmp8, %lor.rhs ], [ true, %entry ]
  %lor.ext = zext i1 %0 to i32
  ret i32 %lor.ext

which failed to merge the compare-with-92 into the switch.  With this patch
we simplify this all the way to:

  switch i8 %c, label %lor.rhs [
    i8 62, label %lor.end
    i8 34, label %lor.end
    i8 92, label %lor.end
  ]

lor.rhs:                                          ; preds = %entry
  br label %lor.end

lor.end:                                          ; preds = %entry, %entry, %entry, %lor.rhs
  %0 = phi i1 [ true, %entry ], [ false, %lor.rhs ], [ true, %entry ], [ true, %entry ]
  %lor.ext = zext i1 %0 to i32
  ret i32 %lor.ext

which is much better for codegen's switch lowering stuff.  This kicks in 33 times
on 176.gcc (for example) cutting 103 instructions off the generated code.





git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121671 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 03:18:54 +00:00
..
Hello Since the Hello pass is built as a loadable dynamic library, don't try to convert it to new-style registration yet. 2010-10-07 00:31:16 +00:00
InstCombine Generalize the and-icmp-select instcombine further by allowing selects of the form 2010-12-11 10:49:22 +00:00
Instrumentation Get rid of static constructors for pass registration. Instead, every pass exposes an initializeMyPassFunction(), which 2010-10-19 17:21:58 +00:00
IPO reapply r121100 with a tweak to constant fold ConstExprs with TargetData 2010-12-07 04:33:29 +00:00
Scalar simplify code and reduce indentation 2010-12-13 02:38:13 +00:00
Utils fix a fairly serious oversight with switch formation from 2010-12-13 03:18:54 +00:00
Makefile Revert r100896 and around - this breaks the only mingw32 buildbot we have. 2010-04-15 19:51:42 +00:00