public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [RFC] Fix recent popcount change is breaking
@ 2018-07-10 13:06 Kugan Vivekanandarajah
  2018-07-10 13:18 ` Richard Biener
  0 siblings, 1 reply; 16+ messages in thread
From: Kugan Vivekanandarajah @ 2018-07-10 13:06 UTC (permalink / raw)
  To: GCC Patches; +Cc: Jeff Law

[-- Attachment #1: Type: text/plain, Size: 552 bytes --]

Hi,

Jeff told me that the recent popcount built-in detection is causing
kernel build issues as
ERROR: "__popcountsi2"
[drivers/net/wireless/broadcom/brcm80211/brcmfmac/brcmfmac.ko] undefined!

I could also reproduce this. AFIK, we should check if the libfunc is
defined while checking popcount?

I am testing the attached RFC patch. Is this reasonable?

Thanks,
Kugan

gcc/ChangeLog:

2018-07-10  Kugan Vivekanandarajah  <kuganv@linaro.org>

    * tree-ssa-loop-niter.c (number_of_iterations_popcount): Check
    if libfunc for popcount is available.

[-- Attachment #2: p.txt --]
[-- Type: text/plain, Size: 988 bytes --]

diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c
index f6fa2f7..2e2b9c6 100644
--- a/gcc/tree-ssa-loop-niter.c
+++ b/gcc/tree-ssa-loop-niter.c
@@ -21,6 +21,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "system.h"
 #include "coretypes.h"
 #include "backend.h"
+#include "target.h"
 #include "rtl.h"
 #include "tree.h"
 #include "gimple.h"
@@ -42,6 +43,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "tree-chrec.h"
 #include "tree-scalar-evolution.h"
 #include "params.h"
+#include "optabs-libfuncs.h"
 #include "tree-dfa.h"
 
 
@@ -2570,6 +2572,10 @@ number_of_iterations_popcount (loop_p loop, edge exit,
 	   (long_long_integer_type_node))
     fn = builtin_decl_implicit (BUILT_IN_POPCOUNTLL);
 
+  /* Check if libfunc for popcount is available.  */
+  if (!optab_libfunc (popcount_optab,
+		      TYPE_MODE (TREE_TYPE (src))))
+    return false;
   /* ??? Support promoting char/short to int.  */
   if (!fn)
     return false;

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-11-24  6:38 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-10 13:06 [RFC] Fix recent popcount change is breaking Kugan Vivekanandarajah
2018-07-10 13:18 ` Richard Biener
2018-07-10 13:27   ` Jakub Jelinek
2018-07-10 13:34     ` Richard Biener
2018-07-10 14:44     ` Jeff Law
2018-07-10 14:42   ` Jeff Law
2018-07-11  1:13   ` Kugan Vivekanandarajah
2018-07-11  1:19     ` Andrew Pinski
2018-07-11  1:35       ` Kugan Vivekanandarajah
2018-07-11  5:43         ` Andrew Pinski
2018-07-11 11:26           ` Kugan Vivekanandarajah
2018-07-11 12:31             ` Richard Biener
2018-07-27 13:34               ` Martin Liška
2018-07-27 15:14                 ` Richard Biener
2018-07-27 23:36                   ` Kugan Vivekanandarajah
2018-11-24  6:38                     ` Bin.Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).