superoptimizer evaluation

Hello folks,

Over the last few years I provided a few links (below) to some optimizations derived by Souper.

I know that at least a few of these optimizations got implemented in LLVM but I don't have any good data on this. If you implemented any of these, or know of some that got implemented, could you drop me a line?

Also I'll be at the upcoming dev meeting in San Jose and would love to chat with folks about this stuff.

Thanks,

John

http://lists.llvm.org/pipermail/llvm-dev/2014-November/078971.html
http://lists.llvm.org/pipermail/llvm-dev/2015-July/088481.html

Hi John,
IIRC, the following commits are a direct/indirect result of using Souper:

r268735: [SimplifyCFG] Prefer a simplification based on a dominating condition.
r268636: [ValueTracking] Improve isImpliedCondition for matching LHS and Imm RHSs.
r268104: [InstCombine] Determine the result of a select based on a dominating condition.
r267430: [ValueTracking] Improve isImpliedCondition when the dominating cond is false.
r267177: [SimplifyCFG] Add final missing implications to isImpliedTrueByMatchingCmp.
r267171: [SimplifyCFG] Add missing implications to isImpliedTrueByMatchingCmp.
r266767: [ValueTracking] Improve isImpliedCondition for conditions with matching operands.

   Chad

%0:i32 = var
%1:i32 = and 1:i32, %0
%2:i1 = ne 0:i32, %1
infer %2
%3:i1 = trunc %0
result %3

We canonicalize from a trunc to the and/icmp sequence. I’m not sure why. Does anyone know the history?

// Canonicalize trunc x to i1 → (icmp ne (and x, 1), 0), likewise for vector.
if (DestTy->getScalarSizeInBits() == 1) {
Constant *One = ConstantInt::get(SrcTy, 1);
Src = Builder->CreateAnd(Src, One);
Value *Zero = Constant::getNullValue(Src->getType());
return new ICmpInst(ICmpInst::ICMP_NE, Src, Zero);
}