re PR rtl-optimization/33172 (Optimizer fails to elid away unreferenced static function)
PR tree-optimize/33172 PR tree-optimize/43411 * gcc.dg/tree-ssa/pr33172.c: New testcase. * g++.dg/tree-ssa/pr43411.C: New testcase. From-SVN: r166557
This commit is contained in:
parent
b6173d509c
commit
edb29996a5
|
@ -1,3 +1,10 @@
|
|||
2010-11-10 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR tree-optimize/33172
|
||||
PR tree-optimize/43411
|
||||
* gcc.dg/tree-ssa/pr33172.c: New testcase.
|
||||
* g++.dg/tree-ssa/pr43411.C: New testcase.
|
||||
|
||||
2010-11-10 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
PR tree-optimize/46228
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
class P { public: virtual int val() { return 123; } };
|
||||
class Psub : public P { };
|
||||
|
||||
extern int sink1, sink2;
|
||||
|
||||
void test() {
|
||||
Psub p;
|
||||
P &pRef = p;
|
||||
sink1 = p.val();
|
||||
sink2 = pRef.val();
|
||||
}
|
||||
|
||||
|
||||
inline int v(P &p) { return p.val(); }
|
||||
|
||||
void testInlineP() {
|
||||
P p;
|
||||
sink1 = v(p);
|
||||
}
|
||||
|
||||
void testInlinePsub() {
|
||||
Psub p;
|
||||
sink1 = v(p);
|
||||
}
|
||||
|
||||
// { dg-final { scan-tree-dump-not "OBJ_TYPE_REF" "optimized" } }
|
||||
// { dg-final { cleanup-tree-dump "optimized" } }
|
|
@ -0,0 +1,42 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
|
||||
struct abc {
|
||||
void (*abc_call)(void);
|
||||
};
|
||||
|
||||
/*
|
||||
* Use only any one of the three definitions below at a time:
|
||||
*
|
||||
* 1. nothing optimized away. Good.
|
||||
* 2. call_func() _not_ optimized away, but struct xyz is. gcc disappoints.
|
||||
* 3. both call_func() and struct xyz optimized away. Nice.
|
||||
*/
|
||||
|
||||
/* 1 */
|
||||
/*extern int do_register(struct abc *xyz);*/
|
||||
|
||||
/* 2 */
|
||||
static inline int do_register(struct abc *xyz)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 3 */
|
||||
/*#define do_register(xyz) do { (void)(xyz); } while (0)*/
|
||||
|
||||
static void call_func(void)
|
||||
{
|
||||
}
|
||||
|
||||
static struct abc xyz = {
|
||||
.abc_call = call_func,
|
||||
};
|
||||
|
||||
void func(void)
|
||||
{
|
||||
do_register(&xyz);
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-not "call_func" "optimized"} } */
|
||||
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
Loading…
Reference in New Issue