[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-03-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Martin Liška  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
  Known to work||6.3.0
 Resolution|--- |FIXED
  Known to fail|6.3.0   |

--- Comment #14 from Martin Liška  ---
Fixed on trunk add gcc 6 branch.

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-03-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #13 from Martin Liška  ---
Author: marxin
Date: Wed Mar 22 14:32:42 2017
New Revision: 246385

URL: https://gcc.gnu.org/viewcvs?rev=246385=gcc=rev
Log:
Backport r246119

2017-03-22  Martin Liska  

Backport from mainline
2017-03-14  Martin Liska  

PR lto/66295
* multiple_target.c (expand_target_clones): Drop local.local
flag for default implementation.
2017-03-22  Martin Liska  

Backport from mainline
2017-03-14  Martin Liska  

PR lto/66295
* gcc.dg/tree-prof/pr66295.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/tree-prof/pr66295.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/multiple_target.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-03-22 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #12 from Martin Liška  ---
Author: marxin
Date: Wed Mar 22 14:31:55 2017
New Revision: 246383

URL: https://gcc.gnu.org/viewcvs?rev=246383=gcc=rev
Log:
Backport r245155

2017-03-22  Martin Liska  

Backport from mainline
2017-02-03  Martin Liska  

PR lto/66295
* multiple_target.c (create_dispatcher_calls): Redirect edge
from a caller of a dispatcher.
(expand_target_clones): Make the clones local.
(ipa_target_clone): Do both target clones and resolvers.
(ipa_dispatcher_calls): Remove the pass.
(pass_dispatcher_calls::gate): Likewise.
(make_pass_dispatcher_calls): Likewise.
* passes.def (pass_target_clone): Put as very first IPA early
pass.
2017-03-22  Martin Liska  

Backport from mainline
2017-02-03  Martin Liska  

PR lto/66295
* gcc.target/i386/mvc9.c: New test.

Added:
branches/gcc-6-branch/gcc/testsuite/gcc.target/i386/mvc9.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/multiple_target.c
branches/gcc-6-branch/gcc/passes.def
branches/gcc-6-branch/gcc/testsuite/ChangeLog

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-03-15 Thread jiwang at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Jiong Wang  changed:

   What|Removed |Added

 CC||jiwang at gcc dot gnu.org

--- Comment #11 from Jiong Wang  ---
I think the testcase "gcc.dg/tree-prof/pr66295.c" needs to be restricted on
x86_64-*-*, i?86-*-*.

I am seeing the following errors:

...tree-prof/pr66295.c:14:1: error: target attribute 'avx' is invalid

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-03-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Martin Liška  changed:

   What|Removed |Added

  Known to work||7.0

--- Comment #10 from Martin Liška  ---
Now it should really work on trunk.

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-03-14 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #9 from Martin Liška  ---
Author: marxin
Date: Tue Mar 14 11:59:59 2017
New Revision: 246119

URL: https://gcc.gnu.org/viewcvs?rev=246119=gcc=rev
Log:
Fix multiple target clones nodes (PR lto/66295).

2017-03-14  Martin Liska  

PR lto/66295
* multiple_target.c (expand_target_clones): Drop local.local
flag for default implementation.
2017-03-14  Martin Liska  

PR lto/66295
* gcc.dg/tree-prof/pr66295.c: New test.

Added:
trunk/gcc/testsuite/gcc.dg/tree-prof/pr66295.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/multiple_target.c
trunk/gcc/testsuite/ChangeLog

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-03-13 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #8 from Martin Liška  ---
There's one follow-up issue I forgot to fix:

$ gcc pr78419.c -fprofile-generate -O2 -g && ./a.out && gcc -fprofile-use -O2
pr78419.c -fdump-ipa-profile-details
pr78419.c:34:1: internal compiler error: in initialize_node_lattices, at
ipa-cp.c:1151
 }
 ^
0x16cb656 initialize_node_lattices
../../gcc/ipa-cp.c:1151
0x16cb656 ipcp_propagate_stage
../../gcc/ipa-cp.c:3251
0x16cc946 ipcp_driver
../../gcc/ipa-cp.c:4996
0x16cc946 execute
../../gcc/ipa-cp.c:5090

I've got patch for that.

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-02-03 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #7 from Martin Liška  ---
Author: marxin
Date: Fri Feb  3 15:22:47 2017
New Revision: 245155

URL: https://gcc.gnu.org/viewcvs?rev=245155=gcc=rev
Log:
Simplify creation of target_clones (PR lto/66295)

2017-02-03  Martin Liska  

PR lto/66295
* multiple_target.c (create_dispatcher_calls): Redirect edge
from a caller of a dispatcher.
(expand_target_clones): Make the clones local.
(ipa_target_clone): Do both target clones and resolvers.
(ipa_dispatcher_calls): Remove the pass.
(pass_dispatcher_calls::gate): Likewise.
(make_pass_dispatcher_calls): Likewise.
* passes.def (pass_target_clone): Put as very first IPA early
pass.
2017-02-03  Martin Liska  

PR lto/66295
* gcc.target/i386/mvc9.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/i386/mvc9.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/multiple_target.c
trunk/gcc/passes.def
trunk/gcc/testsuite/ChangeLog

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2017-01-13 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org
   Assignee|hubicka at gcc dot gnu.org |marxin at gcc dot 
gnu.org

--- Comment #6 from Martin Liška  ---
I've got a patch for that. Currently testing.

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2016-07-22 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #5 from Richard Biener  ---
for example g++.dg/ext/mvc1.C ICEs with LTO because the simple IPA pass
target_clone which runs in the IPA pipeline ICEs during WPA:

lto1: internal compiler error: Segmentation fault^M
0xd66336 crash_signal^M
/space/rguenther/src/svn/early-lto-debug/gcc/toplev.c:335^M
0xe0940d copy_forbidden(function*)^M
/space/rguenther/src/svn/early-lto-debug/gcc/tree-inline.c:3524^M

this is because DECL_STRUCT_FUNCTION is NULL as ipa_target_clone does

static unsigned int
ipa_target_clone (void)
{
  struct cgraph_node *node;

  target_clone_pass = false;
  FOR_EACH_FUNCTION (node)
if (node->definition)
  target_clone_pass |= expand_target_clones (node, true);
  return 0;

but it seems to expect bodies to be available.  It looks like the pass wants
to create clones that are materialized only in one of the ltrans units instead
and thus this IPA pass is really not LTO aware properly.

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2016-07-08 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2016-06-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Richard Biener  changed:

   What|Removed |Added

   Target Milestone|--- |5.5

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2016-06-01 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #4 from Jan Hubicka  ---
In resolution file we have:
1
q.o 5
200 7c41b073ca657863 PREVAILING_DEF_IRONLY _Z3foov
212 7c41b073ca657863 PREVAILING_DEF_IRONLY _Z3foov.arch_core2
215 7c41b073ca657863 PREVAILING_DEF_IRONLY _Z3foov.resolver
222 7c41b073ca657863 PREVAILING_DEF_IRONLY _Z13_Z3foov.ifuncv
224 7c41b073ca657863 PREVAILING_DEF main

which seems to miss the fact that _Z13_Z3foov.ifuncv is magic (I believe
because it is the resolver that should be used to find proper implementation). 
I suppose linker has no way to tell us, because ifuncs are not streamed to LTO
symtab.  How exactly the ifuncs are represented in normal ELF?

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2016-05-31 Thread hubicka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Jan Hubicka  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |hubicka at gcc dot 
gnu.org

--- Comment #3 from Jan Hubicka  ---
I will take a look.

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2016-05-31 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

--- Comment #2 from Markus Trippelsdorf  ---
__attribute__((target("default"))) int foo() { return 1; }
__attribute__((target("arch=core2"))) int foo() { return 2; }
int main() {
  if (foo() != 1 && foo() != 2)
__builtin_abort();
}

[Bug lto/66295] [5/6/7 Regression] LTO generates incorrect resolver call for function multiversioning

2016-05-31 Thread trippels at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66295

Markus Trippelsdorf  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-05-31
 CC||trippels at gcc dot gnu.org
  Known to work||4.9.3
Summary|LTO generates incorrect |[5/6/7 Regression] LTO
   |resolver call for function  |generates incorrect
   |multiversioning |resolver call for function
   ||multiversioning
 Ever confirmed|0   |1

--- Comment #1 from Markus Trippelsdorf  ---
Confirmed.