http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55913
Bug #: 55913 Summary: ipa-cp should consider also constants implied by the context it is clonning for Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: hubi...@gcc.gnu.org In the following testcase (devirt10-C) ipa-cp should devirtualize both calls class wxPaintEvent { }; struct wxDCBase { wxDCBase (); virtual int GetLayoutDirection() const{} virtual void SetLayoutDirection(int){} }; struct wxWindowDC : public wxDCBase {}; struct wxBufferedDC : public wxDCBase { void Init(wxDCBase*dc) { InitCommon(dc); } void InitCommon(wxDCBase*dc) { if (dc) SetLayoutDirection(dc->GetLayoutDirection()); } }; struct wxBufferedPaintDC : public wxBufferedDC { wxBufferedPaintDC() { Init(&m_paintdc); } wxWindowDC m_paintdc; }; void OnPaint(wxPaintEvent & event) { wxBufferedPaintDC dc; } On all calls both THIS and DC binfos are known. There is no need to create clone for THIS binfo known and DC unknown as it is done presently.