intermodule optimization bug

Fergus Henderson fjh at cs.mu.oz.au
Fri Oct 24 20:18:07 AEST 1997


Simon Taylor, you wrote:
> 
> io__report_stats calls benchmarking:report_stats, which does non-logical 
> I/O. The compiler is allowed to optimize away the second call to 
> benchmarking:report_stats since it has the same inputs as the first.
> The best fix for this is to add :- pragma(no_inline, io__report_stats/2) 
> to io.m.

Yes, I agree that this is the best fix for now.

library/io.m:
	Add `pragma no_inline' declaration for io__report_stats,
	to prevent duplicate-call optimization of report_stats/0.

Index: io.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/io.m,v
retrieving revision 1.141
diff -u -u -r1.141 io.m
--- io.m	1997/10/08 13:27:47	1.141
+++ io.m	1997/10/24 10:11:50
@@ -1899,6 +1899,12 @@
 
 % memory management predicates
 
+% The implementation of io__report_stats/2 in terms of the non-logical
+% report_stats/0 causes problems with --optimize-duplicate-calls.
+% So we need to prevent inlining.
+
+:- pragma no_inline(io__report_stats/2).
+
 io__report_stats -->
 	{ report_stats }.
 

-- 
Fergus Henderson <fjh at cs.mu.oz.au>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3         |     -- the last words of T. S. Garp.



More information about the developers mailing list