<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - isl_sioimath_add not always inlined"
   href="https://llvm.org/bugs/show_bug.cgi?id=28411">28411</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>isl_sioimath_add not always inlined
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Polly
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>isl
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>polly-dev@googlegroups.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>tobias@grosser.es
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Certain compilers do not always inline the functions isl_sioimath_add, 
isl_sioimath_mul, and isl_sioimath_addmul. Also, a specialized shortcut for
isl_sioimath_addmul might improve the execution time of this function.
This has been observed with
<a href="https://llvm.org/svn/llvm-project/polly/trunk@274430">https://llvm.org/svn/llvm-project/polly/trunk@274430</a>.

We should investigate how beneficial these optimization opportunities are.

The following patch can serve as starting point:

--- a/lib/External/isl/isl_int_sioimath.h
+++ b/lib/External/isl/isl_int_sioimath.h
@@ -628,7 +628,7 @@ inline void isl_sioimath_sub_ui(isl_sioimath_ptr dst,
isl_sioimath lhs,

 /* Sum of two isl_ints.
  */
-inline void isl_sioimath_add(isl_sioimath_ptr dst, isl_sioimath_src lhs,
+inline __attribute__((always_inline)) void isl_sioimath_add(isl_sioimath_ptr
dst, isl_sioimath_src lhs,
        isl_sioimath_src rhs)
 {
        isl_sioimath_scratchspace_t scratchlhs, scratchrhs;
@@ -670,7 +670,7 @@ inline void isl_sioimath_sub(isl_sioimath_ptr dst,
isl_sioimath_src lhs,

 /* Multiply two isl_ints.
  */
-inline void isl_sioimath_mul(isl_sioimath_ptr dst, isl_sioimath_src lhs,
+inline __attribute__((always_inline))  void isl_sioimath_mul(isl_sioimath_ptr
dst, isl_sioimath_src lhs,
        isl_sioimath_src rhs)
 {
        isl_sioimath_scratchspace_t scratchlhs, scratchrhs;
@@ -799,9 +799,19 @@ inline void isl_sioimath_pow_ui(isl_sioimath_ptr dst,
isl_sioimath_src lhs,

 /* Fused multiply-add.
  */
-inline void isl_sioimath_addmul(isl_sioimath_ptr dst, isl_sioimath_src lhs,
+inline __attribute__((always_inline)) void
isl_sioimath_addmul(isl_sioimath_ptr dst, isl_sioimath_src lhs,
        isl_sioimath_src rhs)
 {
+       int32_t smalllhs, smallrhs, smalldst;
+
+        if (isl_sioimath_decode_small(lhs, &smalllhs) &&
+            isl_sioimath_decode_small(rhs, &smallrhs) &&
+            isl_sioimath_decode_small(*dst, &smalldst)) {
+                isl_sioimath_set_int64(
+                   dst, (int64_t) smalldst +
+                   (int64_t) smalllhs * (int64_t) smallrhs);
+                return;
+        }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>