> > > > Richi, I think we can add "safe" parameter to gimple_call_arg_flags and > > bypass this logic when we use it for warnings only (having body that > > does not use the value is quite strong hint that it is unused by the > > function). > > Eh, please not.
OK, I do not care that much as long as we do not have false positives everywhere :) Hadling EAF_UNUSED and CONST functions is necessary so we do not get false positive caused by us optimizing code out. In this case of not trusing EAF_UNUSED flag we will not optimize, so I do not really care. Martin, we collected very many warnings when building with configure --with-build-config=bootstrap-lto.mk This patch fixes some of them, but there are many others, can you take a look? For the testcase in PR I think it is enough to use default_is_empty_type to disable the warning, but it is not clear to me why the code uses default_is_empty_record at first place. > > > > > I played with bit more testcases and found that we also want to disable > > warning for const functions and sometimes EAF_UNUSED flag is dropped > > becaue of clobber that is not necessary to do. If function only clobber > > the target it can be considered unused past inlining. > > > > I am testing this improved patch and plan to commit if there are no > > complains, but still we need to handle binds_to_current_def. > > > > On the other direction, Martin, I think we may also warn for args > > that are !EAF_UNUSED and !EAF_NOCLOBBER. This will catch some cases > > where user did not add "const" specifier to the declaration but > > parameter is detected to be readonly. > > > > I also noticed that we do not detect EAF_UNUSED for fully unused > > parameters (with no SSA names associated with them). I will fix that > > incrementally. > > Make sure to not apply it based on that reason to aggregates ;) Sure, we already have detection of unused params in ipa-prop, so I guess we want is_giple_ref (parm) && !default_def to imply EAF_UNUSED. Honza
