Changeset: 9a13606d13aa for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9a13606d13aa
Modified Files:
        configure.ag
        monetdb5/modules/mal/mkey.c
Branch: Jun2020
Log Message:

GCC both on Fedora 31 and 32 have a problem optimizing mkey.c with -O3.
So we use -O2 for GCC when using --enable-optimize.  We then don't
need a hacky call to a function in the loop.


diffs (74 lines):

diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -856,7 +856,7 @@ AS_CASE([$enable_optimize], [yes], [
                        # -finline-functions, -funswitch-loops,
                        # -fpredictive-commoning, -fgcse-after-reload,
                        # -ftree-vectorize and -fipa-cp-clone
-                       CFLAGS="-O3 -fomit-frame-pointer -pipe ${CFLAGS}"
+                       CFLAGS="-O2 -fomit-frame-pointer -pipe ${CFLAGS}"
                        # because we explicitly disable debugging, we can 
explicitly
                        # enable -fomit-frame-pointer here
                        # notes on -funroll-all-loops:
diff --git a/monetdb5/modules/mal/mkey.c b/monetdb5/modules/mal/mkey.c
--- a/monetdb5/modules/mal/mkey.c
+++ b/monetdb5/modules/mal/mkey.c
@@ -40,18 +40,6 @@ MKEYrotate(lng *res, const lng *val, con
        return MAL_SUCCEED;
 }
 
-#if defined(__GNUC__) && __GNUC__ == 10
-/* There is a bug in GCC 10.0.1 (at least 10.0.1-0.13) where the loops
- * where this function is inserted is optimized incorrectly, resulting
- * in incorrect results.  By adding a call to what is in essence a
- * dummy function we force the optimizer to simplify its optimization
- * and we get the correct results. */
-#define WORK_AROUND_GNUC_BUG() GDKclrerr()
-#else
-/* no need to do this thing of not gcc 10 */
-#define WORK_AROUND_GNUC_BUG() ((void) 0)
-#endif
-
 str
 MKEYhash(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p)
 {
@@ -282,7 +270,6 @@ MKEYbulk_rotate_xor_hash(bat *res, const
                const bte *restrict v = (const bte *) Tloc(b, 0);
                for (BUN i = 0; i < n; i++) {
                        r[i] = GDK_ROTATE(h[i], lbit, rbit) ^ MKEYHASH_bte(v + 
i);
-                       WORK_AROUND_GNUC_BUG();
                }
                break;
        }
@@ -290,7 +277,6 @@ MKEYbulk_rotate_xor_hash(bat *res, const
                const sht *restrict v = (const sht *) Tloc(b, 0);
                for (BUN i = 0; i < n; i++) {
                        r[i] = GDK_ROTATE(h[i], lbit, rbit) ^ MKEYHASH_sht(v + 
i);
-                       WORK_AROUND_GNUC_BUG();
                }
                break;
        }
@@ -299,7 +285,6 @@ MKEYbulk_rotate_xor_hash(bat *res, const
                const int *restrict v = (const int *) Tloc(b, 0);
                for (BUN i = 0; i < n; i++) {
                        r[i] = GDK_ROTATE(h[i], lbit, rbit) ^ MKEYHASH_int(v + 
i);
-                       WORK_AROUND_GNUC_BUG();
                }
                break;
        }
@@ -308,7 +293,6 @@ MKEYbulk_rotate_xor_hash(bat *res, const
                const lng *restrict v = (const lng *) Tloc(b, 0);
                for (BUN i = 0; i < n; i++) {
                        r[i] = GDK_ROTATE(h[i], lbit, rbit) ^ MKEYHASH_lng(v + 
i);
-                       WORK_AROUND_GNUC_BUG();
                }
                break;
        }
@@ -317,7 +301,6 @@ MKEYbulk_rotate_xor_hash(bat *res, const
                const hge *restrict v = (const hge *) Tloc(b, 0);
                for (BUN i = 0; i < n; i++) {
                        r[i] = GDK_ROTATE(h[i], lbit, rbit) ^ MKEYHASH_hge(v + 
i);
-                       WORK_AROUND_GNUC_BUG();
                }
                break;
        }
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to