llvm-6502/lib
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
..
Analysis Remove useless dynamic_cast<>(). 2010-12-12 21:58:28 +00:00
Archive Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients. 2010-12-09 17:36:48 +00:00
AsmParser Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients. 2010-12-09 17:36:48 +00:00
Bitcode Generalize the darwin wrapper hack to work with generic macho triples as well as darwin ones. 2010-11-29 23:29:54 +00:00
CodeGen reduce indentation by using continue, no functionality change. 2010-12-13 01:11:17 +00:00
CompilerDriver Now to chant the magical incantation that will exorcise the System library 2010-11-29 19:44:50 +00:00
ExecutionEngine Remove unneeded zero arrays. 2010-12-04 15:28:22 +00:00
Linker Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients. 2010-12-09 17:36:48 +00:00
MC Thumb unconditional branch binary encoding. rdar://8754994 2010-12-10 18:21:33 +00:00
Object Mach-O: Tweak field name. 2010-12-10 06:19:39 +00:00
Support Support/Windows/PathV2: Fix header comment. 2010-12-09 17:37:42 +00:00
Target add a note 2010-12-13 00:15:25 +00:00
Transforms fix a fairly serious oversight with switch formation from 2010-12-13 03:18:54 +00:00
VMCore Support/MemoryBuffer: Replace all uses of std::string *ErrMsg with error_code &ec. And fix clients. 2010-12-09 17:36:48 +00:00
Makefile Add LLVMObject Library. 2010-11-15 03:21:41 +00:00