[llvm-bugs] [Bug 28411] New: isl_sioimath_add not always inlined

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jul 4 07:23:38 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=28411

            Bug ID: 28411
           Summary: isl_sioimath_add not always inlined
           Product: Polly
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: isl
          Assignee: polly-dev at googlegroups.com
          Reporter: tobias at grosser.es
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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
https://llvm.org/svn/llvm-project/polly/trunk@274430.

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;
+        }

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160704/019b64b8/attachment.html>


More information about the llvm-bugs mailing list