From 7a708f68bfb52c2986e2ef39bfa40a7bb3fbb51e Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 15 Jul 2015 09:28:33 +0200 Subject: re PR rtl-optimization/66838 (Calling multiple SYSV AMD64 ABI functions from MS x64 ABI one results in clobbered parameters) PR rtl-optimization/66838 * postreload.c (reload_cse_move2add): Also process CALL_INSN_FUNCTION_USAGE when resetting information of call-clobbered registers. testsuite/ChangeLog: PR rtl-optimization/66838 * gcc.target/i386/pr66838.c: New test. From-SVN: r225806 --- gcc/postreload.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'gcc/postreload.c') diff --git a/gcc/postreload.c b/gcc/postreload.c index a7eb55f..88d5234 100644 --- a/gcc/postreload.c +++ b/gcc/postreload.c @@ -2127,12 +2127,29 @@ reload_cse_move2add (rtx_insn *first) unknown values. */ if (CALL_P (insn)) { + rtx link; + for (i = FIRST_PSEUDO_REGISTER - 1; i >= 0; i--) { if (call_used_regs[i]) /* Reset the information about this register. */ reg_mode[i] = VOIDmode; } + + for (link = CALL_INSN_FUNCTION_USAGE (insn); link; + link = XEXP (link, 1)) + { + rtx setuse = XEXP (link, 0); + rtx usage_rtx = XEXP (setuse, 0); + if (GET_CODE (setuse) == CLOBBER + && REG_P (usage_rtx)) + { + unsigned int end_regno = END_REGNO (usage_rtx); + for (unsigned int r = REGNO (usage_rtx); r < end_regno; ++r) + /* Reset the information about this register. */ + reg_mode[r] = VOIDmode; + } + } } } return changed; -- cgit v1.1