<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Juergen,<div><br></div><div>Could you file a PR for the actual issue?</div><div><br></div><div>Thanks,<br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica;  font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">-Quentin</div>

</div>
<br><div><div>On May 19, 2014, at 2:00 PM, Juergen Ributzka <<a href="mailto:juergen@apple.com">juergen@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Author: ributzka<br>Date: Mon May 19 16:00:53 2014<br>New Revision: 209162<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=209162&view=rev">http://llvm.org/viewvc/llvm-project?rev=209162&view=rev</a><br>Log:<br>[ConstantHoisting][X86] Change the cost model to never hoist constants for types larger than i128.<br><br>Currently the X86 backend doesn't support types larger than i128 very well. For<br>example an i192 multiply will assert in codegen when the 2nd argument is a constant and the constant got hoisted.<br><br>This fix changes the cost model to never hoist constants for types larger than<br>i128. Once the codegen issues have been resolved, the cost model can be updated<br>to allow also larger types.<br><br>This is related to <<a href="rdar://problem/16954938">rdar://problem/16954938</a>><br><br>Modified:<br>    llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp<br>    llvm/trunk/test/Transforms/ConstantHoisting/X86/large-immediate.ll<br><br>Modified: llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=209162&r1=209161&r2=209162&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp?rev=209162&r1=209161&r2=209162&view=diff</a><br>==============================================================================<br>--- llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp (original)<br>+++ llvm/trunk/lib/Target/X86/X86TargetTransformInfo.cpp Mon May 19 16:00:53 2014<br>@@ -815,6 +815,13 @@ unsigned X86TTI::getIntImmCost(const API<br>   if (BitSize == 0)<br>     return ~0U;<br><br>+  // Never hoist constants larger than 128bit, because this might lead to<br>+  // incorrect code generation or assertions in codegen.<br>+  // Fixme: Create a cost model for types larger than i128 once the codegen<br>+  // issues have been fixed.<br>+  if (BitSize > 128)<br>+    return TCC_Free;<br>+<br>   if (Imm == 0)<br>     return TCC_Free;<br><br>@@ -830,8 +837,10 @@ unsigned X86TTI::getIntImmCost(unsigned<br>   assert(Ty->isIntegerTy());<br><br>   unsigned BitSize = Ty->getPrimitiveSizeInBits();<br>+  // There is no cost model for constants with a bit size of 0. Return TCC_Free<br>+  // here, so that constant hoisting will ignore this constant.<br>   if (BitSize == 0)<br>-    return ~0U;<br>+    return TCC_Free;<br><br>   unsigned ImmIdx = ~0U;<br>   switch (Opcode) {<br>@@ -892,8 +901,10 @@ unsigned X86TTI::getIntImmCost(Intrinsic<br>   assert(Ty->isIntegerTy());<br><br>   unsigned BitSize = Ty->getPrimitiveSizeInBits();<br>+  // There is no cost model for constants with a bit size of 0. Return TCC_Free<br>+  // here, so that constant hoisting will ignore this constant.<br>   if (BitSize == 0)<br>-    return ~0U;<br>+    return TCC_Free;<br><br>   switch (IID) {<br>   default: return TCC_Free;<br><br>Modified: llvm/trunk/test/Transforms/ConstantHoisting/X86/large-immediate.ll<br>URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstantHoisting/X86/large-immediate.ll?rev=209162&r1=209161&r2=209162&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/ConstantHoisting/X86/large-immediate.ll?rev=209162&r1=209161&r2=209162&view=diff</a><br>==============================================================================<br>--- llvm/trunk/test/Transforms/ConstantHoisting/X86/large-immediate.ll (original)<br>+++ llvm/trunk/test/Transforms/ConstantHoisting/X86/large-immediate.ll Mon May 19 16:00:53 2014<br>@@ -16,3 +16,12 @@ define i512 @test2(i512 %a) nounwind {<br>   %2 = ashr i512 %1, 504<br>   ret i512 %2<br> }<br>+<br>+; Check that we don't hoist constants with a type larger than i128.<br>+define i196 @test3(i196 %a) nounwind {<br>+; CHECK-LABEL: test3<br>+; CHECK-NOT: %const = bitcast i196 2 to i196<br>+  %1 = mul i196 %a, 2<br>+  %2 = mul i196 %1, 2<br>+  ret i196 %2<br>+}<br><br><br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></blockquote></div><br></div></body></html>