diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-03-02 01:04:09 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-03-02 01:04:09 +0000 |
commit | 5e4c46de6d6eaa643c8c9e2f31c4bf92eeed095a (patch) | |
tree | 4d24568265262199d1cb87aade594fb54661d6b5 /llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | |
parent | ab3aefeaa5f58a91b012bf2c5a0599d446523b1a (diff) | |
download | bcm5719-llvm-5e4c46de6d6eaa643c8c9e2f31c4bf92eeed095a.tar.gz bcm5719-llvm-5e4c46de6d6eaa643c8c9e2f31c4bf92eeed095a.zip |
revert r262424 because there's a *clang test* for AArch64 that checks -O3 asm output
that is broken by this change
llvm-svn: 262440
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp index 3cf38c33853..6d0e8821e8f 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp @@ -976,28 +976,16 @@ Instruction *InstCombiner::transformSExtICmp(ICmpInst *ICI, Instruction &CI) { // (x <s 0) ? -1 : 0 -> ashr x, 31 -> all ones if negative // (x >s -1) ? -1 : 0 -> not (ashr x, 31) -> all ones if positive if ((Pred == ICmpInst::ICMP_SLT && Op1C->isNullValue()) || - (Pred == ICmpInst::ICMP_SGT && Op1C->isAllOnesValue()) || + (Pred == ICmpInst::ICMP_SGT && Op1C->isAllOnesValue())) { - // The following patterns should only be present for vectors. - // For scalar integers, the comparison should be canonicalized to one of - // the above forms. We don't do that for vectors because vector ISAs may - // not have a full range of comparison operators. This transform, - // however, will simplify the IR, so we always do it. - // - // (x <=s -1) ? -1 : 0 -> ashr x, 31 -> all ones if negative - // (x >=s 0) ? -1 : 0 -> not (ashr x, 31) -> all ones if positive - (Pred == ICmpInst::ICMP_SLE && Op1C->isAllOnesValue()) || - (Pred == ICmpInst::ICMP_SGE && Op1C->isNullValue())) { Value *Sh = ConstantInt::get(Op0->getType(), - Op0->getType()->getScalarSizeInBits() - 1); - Value *In = Builder->CreateAShr(Op0, Sh, Op0->getName() + ".lobit"); + Op0->getType()->getScalarSizeInBits()-1); + Value *In = Builder->CreateAShr(Op0, Sh, Op0->getName()+".lobit"); if (In->getType() != CI.getType()) In = Builder->CreateIntCast(In, CI.getType(), true/*SExt*/); - // Invert the sign bit if the comparison was checking for 'is positive'. - if (Pred == ICmpInst::ICMP_SGT || Pred == ICmpInst::ICMP_SGE) - In = Builder->CreateNot(In, In->getName() + ".not"); - + if (Pred == ICmpInst::ICMP_SGT) + In = Builder->CreateNot(In, In->getName()+".not"); return replaceInstUsesWith(CI, In); } } |