[Bug tree-optimization/60206] IVOPT has no idea of inline asm

wmi at google dot com gcc-bugzilla@gcc.gnu.org
Mon Mar 10 21:00:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60206

--- Comment #7 from wmi at google dot com ---
After looking into the problem more, I found IVOPT may not be the root cause.
Even if IVOPT create a memory operand using two registers, if only the
following optimizations doesn't propagate the memory operand to an asm_operand,
the problem will not happen. 

So I created another smallcase 2.c for which gcc at the head of trunk will
report the same error. -fno-ivopts will not help here.

gcc -v
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure
--prefix=/usr/local/google/home/wmi/workarea/gcc-r208410/build/install
Thread model: posix
gcc version 4.9.0 20140307 (experimental) (GCC)

gcc -O2 -fno-omit-frame-pointer -m32 -S 2.c

2.c: In function ‘foo’:
2.c:25:1: error: ‘asm’ operand has impossible constraints
 __asm__ (
 ^

The problem will disappear after I use -fno-tree-ter and -fdisable-rtl-combine.
These two phases could propagate a memory reference using a register into an
asm operand with constraint "g", which make the registers used in asm stmt
increase. 

For TER, TER of loads into input arguments is allowed. For combine,
insn_invalid_p() will only check whether an asm operand will satisfy its
constraint. However, neither TER nor combine check whether the propagation
could make the registers in asm stmt exceed available register number.


More information about the Gcc-bugs mailing list