[PATCH] Select Elimination in InstCombine

Gerolf Hoflehner ghoflehner at apple.com
Thu Sep 11 12:08:47 PDT 2014


Please see below.
On Sep 10, 2014, at 11:33 PM, Gerolf Hoflehner <ghoflehner at apple.com> wrote:

> 
> 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.
Looking at this again, it is better to handle the other operand also. It makes the function easier to read.

> 
>> 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
>> 
>> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140911/bd4c1a56/attachment.html>


More information about the llvm-commits mailing list