summaryrefslogtreecommitdiff
path: root/lib/Target/README.txt
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-04-26 20:18:20 +0000
committerChris Lattner <sabre@nondot.org>2011-04-26 20:18:20 +0000
commit325eeb1cd7c3247ead1513204bc9cf4b6e883653 (patch)
tree4e02166fa21871f7f77097284b7f1e5aba28af3c /lib/Target/README.txt
parent5036ce4a64caaeaff4b1f8f1c91836cc2e49a455 (diff)
downloadllvm-325eeb1cd7c3247ead1513204bc9cf4b6e883653.tar.gz
llvm-325eeb1cd7c3247ead1513204bc9cf4b6e883653.tar.bz2
llvm-325eeb1cd7c3247ead1513204bc9cf4b6e883653.tar.xz
Transform: "icmp eq (trunc (lshr(X, cst1)), cst" to "icmp (and X, mask), cst"
when X has multiple uses. This is useful for exposing secondary optimizations, but the X86 backend isn't ready for this when X has a single use. For example, this can disable load folding. This is inching towards resolving PR6627. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/README.txt')
-rw-r--r--lib/Target/README.txt46
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/Target/README.txt b/lib/Target/README.txt
index 99e1252dc8..ffe3fa477b 100644
--- a/lib/Target/README.txt
+++ b/lib/Target/README.txt
@@ -2259,52 +2259,6 @@ icmp transform.
//===---------------------------------------------------------------------===//
-We should optimize this:
-
- %tmp = load i16* %arrayidx, align 4, !tbaa !0
- %A = trunc i16 %tmp to i8
- %cmp = icmp eq i8 %A, 127
- %B.mask = and i16 %tmp, -256
- %cmp7 = icmp eq i16 %B.mask, 17664
- %or.cond = and i1 %cmp, %cmp7
- br i1 %or.cond, label %land.lhs.true9, label %if.end
-
-into:
-
- %tmp = load i16* %arrayidx, align 4, !tbaa !0
- %0 = icmp eq i16 %tmp, 17791
- br i1 %0, label %land.lhs.true9, label %if.end
-
-with this patch:
-Index: InstCombine/InstCombineCompares.cpp
-===================================================================
---- InstCombine/InstCombineCompares.cpp (revision 129500)
-+++ InstCombine/InstCombineCompares.cpp (working copy)
-@@ -2506,6 +2506,18 @@
- return &I;
- }
- }
-+
-+ // Transform "icmp eq (trunc X), cst" to "icmp (and X, mask), cst"
-+ if (Op0->hasOneUse() && match(Op0, m_Trunc(m_Value(A))) &&
-+ isa<ConstantInt>(Op1)) {
-+ APInt MaskV = APInt::getLowBitsSet(A->getType()->getPrimitiveSizeInBits(),
-+ Op0->getType()->getPrimitiveSizeInBits());
-+ Value *Mask =
-+ Builder->CreateAnd(A, ConstantInt::get(A->getContext(), MaskV));
-+ return new ICmpInst(I.getPredicate(), Mask,
-+ ConstantExpr::getZExt(cast<ConstantInt>(Op1),
-+ Mask->getType()));
-+ }
- }
-
- {
-
-
-Not having this is blocking resolving PR6627.
-
-//===---------------------------------------------------------------------===//
-
This code:
typedef struct {