<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Here's a minimal reproducer (preprocessed):<div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">int vscanf(const char *format, __builtin_va_list ap);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">extern int global1;</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">extern int global2;</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">int wrap_vscanf(const char *format, __builtin_va_list ap) {</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  __builtin_va_list aq;</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  __builtin_va_copy(aq, ap);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  vscanf(format, ap);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  __builtin_va_end(aq);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  return 0;</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">}</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">int wrap_scanf(const char *format, ...) {</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  __builtin_va_list ap;</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  __builtin_va_start(ap, format);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  if (global1)</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">    return vscanf(format, ap);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  if (global2)</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">    return vscanf(format, ap);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  wrap_vscanf(format, ap);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  __builtin_va_end(ap);</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">  return 0;</span></font></div></div><div class=""><div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">}</span></font></div></div></blockquote><div class=""><div class=""><br class=""></div><div class="">If you run this on a LLVM TOT build with -DLLVM_ENABLE_EXPENSIVE_CHECKS=On (or actually, you can just un-ifdef the one extra verification in TargetPassConfig::addVerifyPass), you get:</div><div class=""><br class=""></div></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">$ ./bin/clang -arch arm64 -O3 -x c a.c</span></div></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""># After AArch64 load / store optimization pass</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">...</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  fi#-1: size=4, align=16, fixed, at location [SP]</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  fi#0: size=8, align=8, at location [SP-24]</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  fi#1: size=8, align=8, at location [SP-32]</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  fi#2: size=8, align=8, at location [SP-40]</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  fi#3: size=8, align=8, at location [SP-8]</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">  fi#4: size=8, align=8, at location [SP-16]</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">...</div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">BB#4: derived from LLVM BB %17</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    Live Ins: %X0 %X1</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    Predecessors according to CFG: BB#2</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>STURXi %X1, %FP, -8; mem:ST8[%2](tbaa=!4)</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">  </span>%X8<def> = ORRXrs %XZR, %X1<kill>, 0</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">   </span>STRXui %X8<kill>, %SP, 2; mem:ST8[%20]</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre">       </span>BL <ga:@vscanf>, <regmask %FP %LR %B8 %B9 %B10 %B11 %B12 %B13 %B14 %B15 %D8 %D9 %D10 %D11 %D12 %D13 %D14 %D15 %H8 %H9 %H10 %H11 %H12 %H13 %H14 %H15 %S8 %S9 %S10 %S11 %S12 %S13 %S14 %S15 %W19 %W20 %W21 %W22 %W23 %W24 %W25 %W26 %W27 %W28 %W29 %W30 %X19 %X20 %X21 %X22 %X23 %X24 %X25 %X26 %X27 %X28 %D8_D9 %D9_D10 %D10_D11 %D11_D12 %D12_D13 %D13_D14 %D14_D15 %D8_D9_D10_D11 %D9_D10_D11_D12 %D10_D11_D12_D13 %D11_D12_D13_D14 %D12_D13_D14_D15 %D8_D9_D10 %D9_D10_D11 %D10_D11_D12 %D11_D12_D13 %D12_D13_D14 %D13_D14_D15 %W19_W20 %W20_W21 %W21_W22 %W22_W23 %W23_W24 %W24_W25 %W25_W26 %W26_W27 %W27_W28 %W28_W29 %W29_W30 %FP_LR %X28_FP %X19_X20 %X20_X21 %X21_X22 %X22_X23 %X23_X24 %X24_X25 %X25_X26 %X26_X27 %X27_X28>, %LR<imp-def,dead>, %SP<imp-use>, %X0<imp-use>, %X1<imp-use>, %SP<imp-def>, %W0<imp-def,dead></span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><span class="Apple-tab-span" style="white-space:pre"> </span>%W0<def> = MOVZWi 0, 0</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">    Successors according to CFG: BB#5(?%)</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class=""><br class=""></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">...</div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""># End machine code for function wrap_scanf.</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class=""><br class=""></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">*** Bad machine code: Using an undefined physical register ***</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">- function:    wrap_scanf</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">- basic block: BB#4  (0x7fb3f00f50e0)</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">- instruction: BL</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">- operand 5:   %X1<imp-use></span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #c33720" class=""><b class="">fatal error: </b></span><span style="font-variant-ligatures: no-common-ligatures" class="">error in backend: Found 1 machine code errors.</span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal;" class="">...</div></span></div></div></blockquote><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span></div></span></div></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><div style="margin: 0px; font-stretch: normal; line-height: normal; min-height: 13px;" class=""><br class=""><span style="font-variant-ligatures: no-common-ligatures" class=""></span></div></span></div></div><div class=""><div class="">Kuba</div><div class=""><br class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 26 Jun 2017, at 10:09, Tim Northover via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><blockquote type="cite" class="">I think what's actually happening is that parent code is forwarding from the second register in an STP, but r305918 is trying to get the kill flag from the first (unaware that a pair is involved at all). I'll ping the person who wrote it.<br class=""></blockquote><br class="">Nope, that doesn't work either. isMatchingStore only allows non-paired operations. So I still don't know what's going on.<br class=""><br class="">Tim.<br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@lists.llvm.org" class="">llvm-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits<br class=""></div></div></blockquote></div><br class=""></div></div></div></body></html>