Bug 19825 - -fno-loop-optimize2 does not work
Summary: -fno-loop-optimize2 does not work
Status: RESOLVED DUPLICATE of bug 19848
Alias: None
Product: gcc
Classification: Unclassified
Component: driver (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 5900
  Show dependency treegraph
 
Reported: 2005-02-08 16:28 UTC by Thomas Koenig
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2005-02-08 16:28:27 UTC
Apparently, the compiler likes -floop-optimize2 very much and does
not want it to be switched off:

$ gcc -O1 -fno-loop-optimize -fno-loop-optimize2 -S -fverbose-asm example.c
$ cat example.s
        .file   "example.c"
        .pred.safe_across_calls p1-p5,p16-p63
// GNU C 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:  -auxbase -O1 -fno-loop-optimize -fno-loop-optimize2
// -fverbose-asm
// options enabled:  -falign-loops -fargument-alias -fbranch-count-reg
// -fcommon -fcprop-registers -fdefer-pop -feliminate-unused-debug-types
// -ffunction-cse -fgcse-lm -fguess-branch-probability -fident
// -fif-conversion -fif-conversion2 -fivopts -fkeep-static-consts
// -fleading-underscore -floop-optimize2 -fmath-errno -fmerge-constants
// -fomit-frame-pointer -fpeephole -freg-struct-return -fsched-interblock
// -fsched-spec -fsched-stalled-insns-dep -fsplit-ivs-in-unroller
// -ftrapping-math -ftree-ccp -ftree-ch -ftree-copyrename -ftree-dce
// -ftree-dominator-opts -ftree-dse -ftree-fre -ftree-loop-im
// -ftree-loop-ivcanon -ftree-loop-optimize -ftree-lrs -ftree-sra
// -ftree-ter -funwind-tables -fverbose-asm -fzero-initialized-in-bss
// -mgnu-as -mgnu-ld -minline-float-divide-max-throughput -mdwarf2-asm
// -mtune=itanium2

        .text
        .align 16
        .global main#
        .proc main#
main:
        .prologue
        .body
        mov r8 = r0     // <result>,
        br.ret.sptk.many b0     //
        ;;
        .endp main#
        .ident  "GCC: (GNU) 4.0.0 20050130 (experimental)"
$ gcc -dumpmachine
ia64-unknown-linux-gnu
Comment 1 Thomas Koenig 2005-02-08 16:36:06 UTC
This blocks testing of compiler options in PR 5900.
Comment 2 Andrew Pinski 2005-02-08 17:33:50 UTC
There is a section in the source which does this:
  /* Enable new loop optimizer pass if any of its optimizations is called.  */
  if (flag_move_loop_invariants
      || flag_unswitch_loops
      || flag_peel_loops
      || flag_unroll_loops
      || flag_branch_on_count_reg)
    flag_loop_optimize2 = 1;

And -fbranch-count-reg is always enabled.

The documention says:
-floop-optimize2
Perform loop optimizations using the new loop optimizer. The optimizations (loop unrolling, peeling 
and unswitching, loop invariant motion) are enabled by separate flags. 
Comment 3 Andrew Pinski 2005-02-08 17:34:58 UTC
In fact the only thing which -floop-optimize2 does without enabling something else at -O1 is to enable 
-fbranch-count-reg which has no effect on ia64.
Comment 4 Thomas Koenig 2005-02-10 20:31:49 UTC

*** This bug has been marked as a duplicate of 19848 ***