diff options
author | Chris Lattner <sabre@nondot.org> | 2009-06-16 06:11:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-06-16 06:11:35 +0000 |
commit | d23fffeb1603558dc79c509c7dde195acf7e5e61 (patch) | |
tree | 6cc938c8812631910e4a1f73fc6b3109edd1fbb8 /lib/Target/X86/README.txt | |
parent | 714fa95d01ce1a646b52bc529f3dbcf6a06fa29b (diff) | |
download | external_llvm-d23fffeb1603558dc79c509c7dde195acf7e5e61.zip external_llvm-d23fffeb1603558dc79c509c7dde195acf7e5e61.tar.gz external_llvm-d23fffeb1603558dc79c509c7dde195acf7e5e61.tar.bz2 |
I think instcombine should unconditionally do this xform.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73471 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/README.txt')
-rw-r--r-- | lib/Target/X86/README.txt | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/Target/X86/README.txt b/lib/Target/X86/README.txt index 3796aac..767771f 100644 --- a/lib/Target/X86/README.txt +++ b/lib/Target/X86/README.txt @@ -1858,8 +1858,23 @@ Ideal output: setne %al ret -We could do this transformation in instcombine, but it's only clearly -beneficial on platforms with a test instruction. +This should definitely be done in instcombine, canonicalizing the range +condition into a != condition. We get this IR: + +define i32 @a(i32 %x) nounwind readnone { +entry: + %0 = and i32 %x, 127 ; <i32> [#uses=1] + %1 = icmp ugt i32 %0, 31 ; <i1> [#uses=1] + %2 = zext i1 %1 to i32 ; <i32> [#uses=1] + ret i32 %2 +} + +Instcombine prefers to strength reduce relational comparisons to equality +comparisons when possible, this should be another case of that. This could +be handled pretty easily in InstCombiner::visitICmpInstWithInstAndIntCst, but it +looks like InstCombiner::visitICmpInstWithInstAndIntCst should really already +be redesigned to use ComputeMaskedBits and friends. + //===---------------------------------------------------------------------===// Testcase: |