[llvm-commits] [PATCH] fix bug in InstCombiner::visitPHINode()

Jay Foad jay.foad at gmail.com
Sat Apr 16 07:22:56 PDT 2011


> It looks like the only symptom would be a missed optimization.
> The incorrect code checks whether the later non-PHI incoming values
> are all equal to either a basic block[1] or a previous incoming PHI
> node[2], depending on whether the incoming value number is odd or
> even.
> The original value is also re-checked, and that check will only
> succeed if it was the first incoming value
> (getOperandNumForIncomingValue(0) == 0), so in all other cases it will
> simply choose not to do anything.
> The 'first incoming value' case was apparently the only case currently
> tested, which was why this didn't show up in 'make check'
>
> [1]: Which won't happen because they're not valid incoming values.
> [2]: Which won't happen because they're treated differently by PHIsEqualValue().
>
>> Tested with "make check". OK to apply?
>
> LGTM.
> I've constructed some tests for this which I'll check in afterwards.

Thanks for investigating. I've committed the fix now.

Jay.



More information about the llvm-commits mailing list