From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23200 invoked by alias); 9 Feb 2005 12:41:03 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 23032 invoked by uid 48); 9 Feb 2005 12:40:51 -0000 Date: Wed, 09 Feb 2005 17:48:00 -0000 From: "Thomas dot Koenig at online dot de" To: gcc-bugs@gcc.gnu.org Message-ID: <20050209124042.19848.Thomas.Koenig@online.de> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug driver/19848] New: "options passed" from -verbose-asm do not adequately reflect optimization X-Bugzilla-Reason: CC X-SW-Source: 2005-02/txt/msg00665.txt.bz2 List-Id: This caused me a lot of pain in trying to disable specific optimizations with -O1. $ gfortran -O1 -o dasum-1.s -S -fverbose-asm -fno-loop-optimize -fno-tree-sra -fno-tree-ter -fno-omit-frame-pointer -fno-tree-dse -fno-tree-dominator-opts -fno-tree-ch -fno-tree-fre -fno-merge-constants -fno-cprop-registers -fno-if-conversion2 -fno-defer-pop -fno-tree-lrs -fno-guess-branch-probability -fno-tree-ccp -fno-tree-copyrename -fno-tree-dce -fno-if-conversion ../dasum.f $ gfortran -O0 -o dasum-0.s -S -fverbose-asm ../dasum.f $ diff -u dasum-0.s dasum-1.s | head -30 --- dasum-0.s 2005-02-09 13:38:52.000000000 +0100 +++ dasum-1.s 2005-02-09 13:38:46.000000000 +0100 @@ -3,7 +3,12 @@ // GNU F95 version 4.0.0 20050130 (experimental) (ia64-unknown-linux-gnu) // compiled by GNU C version 4.0.0 20050130 (experimental). // GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 -// options passed: -ffixed-form -auxbase-strip -O0 -fverbose-asm +// options passed: -ffixed-form -auxbase-strip -O1 -fverbose-asm +// -fno-loop-optimize -fno-tree-sra -fno-tree-ter -fno-omit-frame-pointer +// -fno-tree-dse -fno-tree-dominator-opts -fno-tree-ch -fno-tree-fre +// -fno-merge-constants -fno-cprop-registers -fno-if-conversion2 +// -fno-defer-pop -fno-tree-lrs -fno-guess-branch-probability -fno-tree-ccp +// -fno-tree-copyrename -fno-tree-dce -fno-if-conversion // options enabled: -falign-loops -fargument-noalias-global // -fbranch-count-reg -fcommon -feliminate-unused-debug-types // -ffunction-cse -fgcse-lm -fident -fivopts -fkeep-static-consts @@ -23,531 +28,280 @@ .prologue 14, 35 .save ar.pfs, r36 alloc r36 = ar.pfs, 3, 4, 2, 0 //,,,, + adds r16 = -8, r12 //,, .vframe r37 mov r37 = r12 //, - adds r12 = -80, r12 //,, + adds r12 = -32, r12 //,, + mov r17 = ar.lc //, + ;; + .savepsp ar.lc, 8 + st8 [r16] = r17, 8 //, mov r38 = r1 //, As you can see from the fact that there is no differences in the "options enabled:" list in the assembly output, the assembly should be identical. However, the compilation results are very different, so -O1 seems to do other, undocumented things. $ cat ../dasum.f double precision function dasum(n,dx,incx) c c takes the sum of the absolute values. c jack dongarra, linpack, 3/11/78. c modified 3/93 to return if incx .le. 0. c modified 12/3/93, array(1) declarations changed to array(*) c double precision dx(*),dtemp integer i,incx,m,mp1,n,nincx c dasum = 0.0d0 dtemp = 0.0d0 if( n.le.0 .or. incx.le.0 )return if(incx.eq.1)go to 20 c c code for increment not equal to 1 c nincx = n*incx do 10 i = 1,nincx,incx dtemp = dtemp + dabs(dx(i)) 10 continue dasum = dtemp return c c code for increment equal to 1 c c c clean-up loop c 20 m = mod(n,6) if( m .eq. 0 ) go to 40 do 30 i = 1,m dtemp = dtemp + dabs(dx(i)) 30 continue if( n .lt. 6 ) go to 60 40 mp1 = m + 1 do 50 i = mp1,n,6 dtemp = dtemp + dabs(dx(i)) + dabs(dx(i + 1)) + dabs(dx(i + 2)) * + dabs(dx(i + 3)) + dabs(dx(i + 4)) + dabs(dx(i + 5)) 50 continue 60 dasum = dtemp return end -- Summary: "options passed" from -verbose-asm do not adequately reflect optimization Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P2 Component: driver AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: Thomas dot Koenig at online dot de CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19848