<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hi Muhammad, </div><div><br></div><div>Please send patches to llvm-commit. </div><div><br></div><pre style="word-wrap: break-word; white-space: pre-wrap; ">+  {
+    Value *X = 0;
+    bool OpsSwapped = false;
+    // Canonicalize SExt or Not to the LHS
+    if (match(Op1, m_SExt(m_Value())) ||
+        match(Op1, m_Not(m_Value()))) {
+      std::swap(Op0, Op1);
+      OpsSwapped = true;
+    }
+
+    // Fold (and (sext bool to A), B) --> (select bool, B, 0)
+    if (match(Op0, m_SExt(m_Value(X))) &&
+        X->getType()->isIntegerTy(1)) {
<br></pre><pre style="word-wrap: break-word; white-space: pre-wrap; ">Please make sure that this transformation also works with vector select.</pre><pre style="word-wrap: break-word; white-space: pre-wrap; ">+      Value *zero = Constant::getNullValue(Op1->getType());</pre><pre style="word-wrap: break-word; white-space: pre-wrap; ">zero -> Zero.</pre><pre style="word-wrap: break-word; white-space: pre-wrap; ">+      return SelectInst::Create(X, Op1, zero);
+    }
+
+    // Fold (and ~(sext bool to A), B) --> (select bool, 0, B)
+    if (match(Op0, m_Not(m_SExt(m_Value(X)))) &&
+        X->getType()->isIntegerTy(1)) {
+      Value *zero = Constant::getNullValue(Op0->getType());
+      return SelectInst::Create(X, zero, Op1);</pre><pre style="word-wrap: break-word; white-space: pre-wrap; ">Same as above.</pre><pre style="word-wrap: break-word; white-space: pre-wrap; ">
+    }
+
+    if (OpsSwapped)
+      std::swap(Op0, Op1);
+  }
+</pre><div>Thanks,</div><div>Nadav</div><div><br></div><div><br></div><div><div>On Jan 29, 2013, at 8:16 AM, <a href="mailto:bugzilla-daemon@llvm.org">bugzilla-daemon@llvm.org</a> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><a href="http://llvm.org/bugs/show_bug.cgi?id=14664">http://llvm.org/bugs/show_bug.cgi?id=14664</a><br><br>--- Comment #2 from Muhammad Tauqir <muhammad.t.ahmad@intel.com> 2013-01-29 10:16:39 CST ---<br>Submitted a patch for the "second part" of the transform:<br>sext-and --> select AND sext-not-and --> select.<br><br>http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130121/163154.html<br><br>Could someone please have a look?<br><br>-- <br>Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email<br>------- You are receiving this mail because: -------<br>You reported the bug.<br></blockquote></div><br></body></html>