[PATCH] CodeGenPrepare: Avoid and/or i1 in select conditions.

Matthias Braun matze at braunis.de
Fri Feb 6 11:32:49 PST 2015


On a side note: Ahmed just mentioned a snipped from SelectionDAGBuilder to me that has pretty much the same logic I do for selects implemented for branches:

 // If this is a series of conditions that are or'd or and'd together, emit
  // this as a sequence of branches instead of setcc's with and/or operations.
  // As long as jumps are not expensive, this should improve performance.
  // For example, instead of something like:
  //     cmp A, B
  //     C = seteq
  //     cmp D, E
  //     F = setle
  //     or C, F
  //     jnz foo
  // Emit:
  //     cmp A, B
  //     je foo
  //     cmp D, E
  //     jle foo
  //
...

no idea why that is in SelectionDAGBuilder, it also doesn't seem strictly beneficial to all targets to me...

> On Feb 5, 2015, at 4:05 PM, Matthias Braun <matze at braunis.de> wrote:
> 
> New Version: This expects the middleend to have selects normalized to selects with and/or conditions (see http://reviews.llvm.org/D7450). The Code to break it into a sequence of multiple selects is now in the CodeGenPrepare pass and relies on a TargetLowering hook to test whether the transformation is useful.
> 
> 
> REPOSITORY
>  rL LLVM
> 
> http://reviews.llvm.org/D7399
> 
> Files:
>  include/llvm/Target/TargetLowering.h
>  lib/CodeGen/CodeGenPrepare.cpp
>  lib/Target/PowerPC/PPCISelLowering.h
>  test/CodeGen/R600/or.ll
>  test/CodeGen/X86/jump_sign.ll
>  test/CodeGen/X86/zext-sext.ll
>  test/Transforms/CodeGenPrepare/select_and_or.ll
> 
> EMAIL PREFERENCES
>  http://reviews.llvm.org/settings/panel/emailpreferences/
> <D7399.19442.patch>_______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list