<div dir="ltr">Oops! Sorry about that. Thank you for letting me know.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 19, 2016 at 10:37 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Er, the actual logs this time:<div><a href="https://build.chromium.org/p/chromium.fyi/builders/ClangToTLinux/builds/6077/steps/compile/logs/stdio" target="_blank">https://build.chromium.org/p/<wbr>chromium.fyi/builders/<wbr>ClangToTLinux/builds/6077/<wbr>steps/compile/logs/stdio</a><br></div><div><br></div><div>I'll land a quick fix and test soon.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Aug 19, 2016 at 9:36 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span><span style="font-size:12.8px">+    Constant *NullVal = ConstantInt::getNullValue(P-></span><span style="font-size:12.8px">g<wbr>etType());</span><br style="font-size:12.8px"><span style="font-size:12.8px">+    Value *CmpP = Builder->CreateICmp(Pred, P, NullVal);</span><br style="font-size:12.8px"><span style="font-size:12.8px">+    Value *CmpQ = Builder->CreateICmp(Pred, Q, NullVal);</span><br><div><span style="font-size:12.8px"><br></span></div></span><div><span style="font-size:12.8px">P and Q might not have equivalent pointer types. We really do need to get two calls to getNullValue here.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Caused a crash while building Chromium:</span></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Aug 17, 2016 at 9:30 AM, Sanjay Patel via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: spatel<br>
Date: Wed Aug 17 11:30:43 2016<br>
New Revision: 278944<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=278944&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=278944&view=rev</a><br>
Log:<br>
[InstCombine] clean up foldICmpOrConstant(); NFCI<br>
<br>
1. Change variable names<br>
2. Use local variables to reduce code<br>
3. Use ? instead of if/else<br>
4. Use the APInt variable instead of 'RHS' so the removal of the FIXME code will be direct<br>
<br>
Modified:<br>
    llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCompares.cp<wbr>p<br>
<br>
Modified: llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCompares.cp<wbr>p<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCompares.cpp?rev=278944&r1=278943&r2=278944&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/llvm/trunk/lib/Transform<wbr>s/InstCombine/InstCombineCompa<wbr>res.cpp?rev=278944&r1=278943&r<wbr>2=278944&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCompares.cp<wbr>p (original)<br>
+++ llvm/trunk/lib/Transforms/Inst<wbr>Combine/InstCombineCompares.cp<wbr>p Wed Aug 17 11:30:43 2016<br>
@@ -1879,40 +1879,38 @@ Instruction *InstCombiner::foldICmpAndCo<br>
   return nullptr;<br>
 }<br>
<br>
-Instruction *InstCombiner::foldICmpOrConst<wbr>ant(ICmpInst &ICI, Instruction *LHSI,<br>
-                                              const APInt *RHSV) {<br>
+/// Fold icmp (or X, Y), C.<br>
+Instruction *InstCombiner::foldICmpOrConst<wbr>ant(ICmpInst &Cmp, Instruction *Or,<br>
+                                              const APInt *C) {<br>
   // FIXME: This check restricts all folds under here to scalar types.<br>
-  ConstantInt *RHS = dyn_cast<ConstantInt>(ICI.getO<wbr>perand(1));<br>
+  ConstantInt *RHS = dyn_cast<ConstantInt>(Cmp.getO<wbr>perand(1));<br>
   if (!RHS)<br>
     return nullptr;<br>
<br>
-  if (RHS->isOne()) {<br>
+  ICmpInst::Predicate Pred = Cmp.getPredicate();<br>
+  if (*C == 1) {<br>
     // icmp slt signum(V) 1 --> icmp slt V, 1<br>
     Value *V = nullptr;<br>
-    if (ICI.getPredicate() == ICmpInst::ICMP_SLT &&<br>
-        match(LHSI, m_Signum(m_Value(V))))<br>
+    if (Pred == ICmpInst::ICMP_SLT && match(Or, m_Signum(m_Value(V))))<br>
       return new ICmpInst(ICmpInst::ICMP_SLT, V,<br>
                           ConstantInt::get(V->getType()<wbr>, 1));<br>
   }<br>
<br>
-  if (!ICI.isEquality() || !RHS->isNullValue() || !LHSI->hasOneUse())<br>
+  if (!Cmp.isEquality() || *C != 0 || !Or->hasOneUse())<br>
     return nullptr;<br>
<br>
   Value *P, *Q;<br>
-  if (match(LHSI, m_Or(m_PtrToInt(m_Value(P)), m_PtrToInt(m_Value(Q))))) {<br>
+  if (match(Or, m_Or(m_PtrToInt(m_Value(P)), m_PtrToInt(m_Value(Q))))) {<br>
     // Simplify icmp eq (or (ptrtoint P), (ptrtoint Q)), 0<br>
     // -> and (icmp eq P, null), (icmp eq Q, null).<br>
-    Value *ICIP = Builder->CreateICmp(ICI.getPre<wbr>dicate(), P,<br>
-                                      Constant::getNullValue(P->getT<wbr>ype()));<br>
-    Value *ICIQ = Builder->CreateICmp(ICI.getPre<wbr>dicate(), Q,<br>
-                                      Constant::getNullValue(Q->getT<wbr>ype()));<br>
-    Instruction *Op;<br>
-    if (ICI.getPredicate() == ICmpInst::ICMP_EQ)<br>
-      Op = BinaryOperator::CreateAnd(ICIP<wbr>, ICIQ);<br>
-    else<br>
-      Op = BinaryOperator::CreateOr(ICIP, ICIQ);<br>
-    return Op;<br>
+    Constant *NullVal = ConstantInt::getNullValue(P->g<wbr>etType());<br>
+    Value *CmpP = Builder->CreateICmp(Pred, P, NullVal);<br>
+    Value *CmpQ = Builder->CreateICmp(Pred, Q, NullVal);<br>
+    auto LogicOpc = Pred == ICmpInst::Predicate::ICMP_EQ ? Instruction::And<br>
+                                                         : Instruction::Or;<br>
+    return BinaryOperator::Create(LogicOp<wbr>c, CmpP, CmpQ);<br>
   }<br>
+<br>
   return nullptr;<br>
 }<br>
<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>