From 0ae2b0219eddaedae59e1a60b90e7ad8393ec546 Mon Sep 17 00:00:00 2001 From: Tobias Grosser Date: Sun, 15 Feb 2015 19:32:09 +0100 Subject: [PATCH] isl_seq_combine: optimize for common case This reduces the isl_test run-time slightly from 5.0s to 4.9s (gmp) and 20.2s to 20.0s (imath). However, for my dependence analysis test case the execution time is reduced by 12.29% for the gmp backend and 13.45% for the imath backend. Signed-off-by: Tobias Grosser Signed-off-by: Sven Verdoolaege --- isl_seq.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/isl_seq.c b/isl_seq.c index fbbc26f1..2159464e 100644 --- a/isl_seq.c +++ b/isl_seq.c @@ -107,6 +107,14 @@ void isl_seq_combine(isl_int *dst, isl_int m1, isl_int *src1, int i; isl_int tmp; + if (dst == src1 && isl_int_is_one(m1)) { + if (isl_int_is_zero(m2)) + return; + for (i = 0; i < len; ++i) + isl_int_addmul(src1[i], m2, src2[i]); + return; + } + isl_int_init(tmp); for (i = 0; i < len; ++i) { isl_int_mul(tmp, m1, src1[i]); -- 2.11.4.GIT