This patch fixes/improves check for valid insn in newly introduced
ADJUST_INSN_LENGTH.

(Please note that other targets (e.g. aarch64) needs similar fix. MIPS
could use NONDEBUG_INSN_P instead of INSN_P there.)

2015-07-25  Uros Bizjak  <ubiz...@gmail.com>

    PR target/67004
    * config/i386/i386.h (ADJUST_INSN_LENGTH): Use NONDEBUG_INSN_P (INSN)
    predicate and INSN_CODE (INSN) >= 0 to check for valid instruction.

Bootstrapped and regression tested on x86_64-linux-gnu {,-m32} with
--enable-checking=rtl. Also, I have started bootstrap with
--enable-checking=valgrind, but it will probably finish sometime in
the next ice age.

Committed to mainline SVN.

Uros.
Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h  (revision 226207)
+++ config/i386/i386.h  (working copy)
@@ -2262,11 +2262,12 @@
 #define DEFAULT_LARGE_SECTION_THRESHOLD 65536
 
 /* Adjust the length of the insn with the length of BND prefix.  */
-#define ADJUST_INSN_LENGTH(INSN, LENGTH)       \
-do {                                           \
-  if (recog_memoized (INSN) >= 0               \
-      && get_attr_maybe_prefix_bnd (INSN))     \
-    LENGTH += ix86_bnd_prefixed_insn_p (INSN); \
+
+#define ADJUST_INSN_LENGTH(INSN, LENGTH)               \
+do {                                                   \
+  if (NONDEBUG_INSN_P (INSN) && INSN_CODE (INSN) >= 0  \
+      && get_attr_maybe_prefix_bnd (INSN))             \
+    LENGTH += ix86_bnd_prefixed_insn_p (INSN);         \
 } while (0)
 
 /* Which processor to tune code generation for.  These must be in sync

Reply via email to