<div dir="ltr">llvm should error-out when a 64-bit variable is bound to a single register in x86 32-bit mode, but ToT clang/llvm fails to detect this error and continues compilation until it crashes in type-legalization:<div>
<br></div><div><div><p style="margin:0px;font-size:11px;font-family:Menlo">$ llc test/CodeGen/X86/inline-asm-regsize.ll  -O3 -mtriple=i386-apple-darwin -o -</p></div><div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">
inline-asm-regsize.ll  -O3 -mtriple=i386-apple-darwin -o -</p>
<p style="margin:0px;font-size:11px;font-family:Menlo"><span class="" style="white-space:pre">        </span>.section<span class="" style="white-space:pre">  </span>__TEXT,__text,regular,pure_instructions</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">ExpandIntegerResult #0: 0x7fa2d1041728: i64 = Register %RCX [ID=0]</p>
<p style="margin:0px;font-size:11px;font-family:Menlo;min-height:13px"><br></p>
<p style="margin:0px;font-size:11px;font-family:Menlo">Do not know how to expand the result of this operator!</p>
<p style="margin:0px;font-size:11px;font-family:Menlo">UNREACHABLE executed at /Users/ahatanaka/projects/llvm/git/llvm3/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:1116!</p></div><div><br></div><div>The attached patch fixes llvm to error-out and print this error message:</div>
<div><br></div><div><p style="margin:0px;font-size:11px;font-family:Menlo">error: Cannot bind a variable larger than 32-bit to a single register in 32-bit mode</p><p style="margin:0px;font-size:11px;font-family:Menlo"><br>
</p><div>My initial solution was to have clang detect this error in TargetInfo::validateConstraintModifier. However, the code in SemaStmtAsm.cpp has to be changed to error-out instead of issuing a warning, which I wasn't sure was the right thing to do. I am attaching this patch too in case someone has a suggestion or an opinion on it.</div>
<div><br></div></div><div><rdar://problem/17476970><br></div><div><br></div></div></div>