<div dir="ltr">I knew that still didn't look right. Should be fixed with r286671 - thanks!<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 11, 2016 at 4:20 PM, Friedman, Eli <span dir="ltr"><<a href="mailto:efriedma@codeaurora.org" target="_blank">efriedma@codeaurora.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 11/11/2016 3:01 PM, Sanjay Patel via llvm-commits wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: spatel<br>
Date: Fri Nov 11 17:01:20 2016<br>
New Revision: 286664<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=286664&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=286664&view=rev</a><br>
Log:<br>
[InstCombine] clean up foldSelectOpOp(); NFC<br>
<br>
Modified:<br>
llvm/trunk/lib/Transforms/Ins<wbr>tCombine/InstCombineSelect.cpp<br>
<br>
Modified: llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineSelect.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineSelect.cpp?rev=286664&r1=286663&r2=286664&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Transform<wbr>s/InstCombine/InstCombineSelec<wbr>t.cpp?rev=286664&r1=286663&r2=<wbr>286664&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineSelect.cpp (original)<br>
+++ llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineSelect.cpp Fri Nov 11 17:01:20 2016<br>
@@ -162,8 +162,6 @@ Instruction *InstCombiner::foldSelectOpO<br>
TI->getType());<br>
}<br>
- // TODO: This function ends awkwardly in unreachable - fix to be more normal.<br>
-<br>
// Only handle binary operators with one-use here. As with the cast case<br>
// above, it may be possible to relax the one-use constraint, but that needs<br>
// be examined carefully since it may not reduce the total number of<br>
@@ -203,14 +201,10 @@ Instruction *InstCombiner::foldSelectOpO<br>
// If we reach here, they do have operations in common.<br>
Value *NewSI = Builder->CreateSelect(SI.getCo<wbr>ndition(), OtherOpT, OtherOpF,<br>
SI.getName() + ".v", &SI);<br>
-<br>
- if (BinaryOperator *BO = dyn_cast<BinaryOperator>(TI)) {<br>
- if (MatchIsOpZero)<br>
- return BinaryOperator::Create(BO->get<wbr>Opcode(), MatchOp, NewSI);<br>
- else<br>
- return BinaryOperator::Create(BO->get<wbr>Opcode(), NewSI, MatchOp);<br>
- }<br>
- llvm_unreachable("Shouldn't get here");<br>
+ BinaryOperator *BO = cast<BinaryOperator>(TI);<br>
</blockquote>
<br></div></div>
It would be better to use dyn_cast<> rather than the isa<>+cast<> anti-pattern.<span class="HOEnZb"><font color="#888888"><br>
<br>
-Eli<br>
<br>
-- <br>
Employee of Qualcomm Innovation Center, Inc.<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project<br>
<br>
</font></span></blockquote></div><br></div>