[PATCH] Select Elimination in InstCombine
Gerolf Hoflehner
ghoflehner at apple.com
Wed Sep 10 23:33:56 PDT 2014
On Sep 10, 2014, at 8:36 PM, David Majnemer <david.majnemer at gmail.com> wrote:
> ================
> Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2459-2461
> @@ +2458,5 @@
> + auto *IC = dyn_cast<ICmpInst>(BI->getCondition());
> + if (!IC || IC->getOperand(0) != SI)
> + return false;
> + return true;
> +}
> ----------------
> majnemer wrote:
>> Gerolf wrote:
>>> majnemer wrote:
>>>> You could make this `return IC && IC->getOperand(0) == SI;`
>>>>
>>>> Are we interested in doing anything if the other operand to the `ICmpInst` is the `SelectInst`?
>>> No, rhs is expected to be a constant.
>> Where do we check this?
Look at the condition that checks RHSC before we enter the select case.
> Thinking about this, isChainSelectCmpBranch is very specific to this transform; I think this makes more sense as a static function instead of a member function.
That is true. It actually is very specific to the select-cmp pattern.
>
> http://reviews.llvm.org/D5258
>
>
More information about the llvm-commits
mailing list