This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

turning off range simplification


I am working on a static analysis tool that works on the gcc Tree-SSA representation. We're having trouble with what I *think* is a tree dominator optimization. 

C code: 
  if( i==1 || i==2 ) { ... }

Tree-SSA code:   
  T.11 = i - 1;
  T.12 = (unsigned int)T.11;
  if (T.12 <= 1) { ... }

This alteration gives our bounds checker fits (we're not inspecting types), so we'd like to be able to suppress it. Preferably, the suppression would be targetted at this one particular code transformation, so that the code we are analyzing closely approximates the code that would otherwise be generated. Experimentation reveals that this happens at -O1 and above. At -O0, the code is as you would expect. I have also tried enabling/disabling all of the optimization flags that are associated with -01 in the documentation, and it does not cause/inhibit the change from occuring. I.e.,

/* change does not occur */
% gcc -fsyntax-only -fdump-tree-gimple -fdefer-pop -fmerge-constants -fthread-jumps -floop-optimize -fif-conversion -fif-conversion2 -fguess-branch-probability -fcprop-registers -ftree-pre -ftree-ccp -ftree-dominator-opts -ftree-ch -ftree-copyrename -ftree-copyrename cond-opt.c

/* change occurs */
% gcc -O -fsyntax-only -fdump-tree-gimple -fno-defer-pop -fno-merge-constants -fno-thread-jumps -fno-loop-optimize -fno-if-conversion -fno-if-conversion2 -fno-guess-branch-probability -fno-cprop-registers -fno-tree-pre -fno-tree-ccp -fno-tree-dominator-opts -fno-tree-ch -fno-tree-copyrename cond-opt.c

We are using gcc version 3.5.0 20040607 (experimental), but we have seen this same behavior with earlier builds. It seems to me there are three possibilities:

a) This transformation is performed by code that is not controlled by a command-line flag.
b) The command-line flag that should control the transformation is not hooked up properly.
c) The command-line flag that does control the transformation is not documented.

If you know whether (a), (b), (c), or (d) "none of the above" is true, I would be most grateful.

Thanks,
Chris


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]