<div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 28, 2012 at 9:55 AM, Michael Liao <span dir="ltr"><<a href="mailto:michael.liao@intel.com" target="_blank">michael.liao@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: hliao<br>
Date: Tue Aug 28 11:55:13 2012<br>
New Revision: 162766<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=162766&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=162766&view=rev</a><br>
Log:<br>
Fix PR13704<br>
<br>
- The increment needs to be signed value to preserve the original value when<br>
  its data type is larger than 64-bit integer.<br></blockquote><div><br></div><div>Thanks for the fix! One small comment:</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Added:<br>
    cfe/trunk/test/CodeGen/pr13704.c<br>
Modified:<br>
    cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=162766&r1=162765&r2=162766&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=162766&r1=162765&r2=162766&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Aug 28 11:55:13 2012<br>
@@ -1306,7 +1306,7 @@<br>
   // Most common case by far: integer increment.<br>
   } else if (type->isIntegerType()) {<br>
<br>
-    llvm::Value *amt = llvm::ConstantInt::get(value->getType(), amount);<br>
+    llvm::Value *amt = llvm::ConstantInt::get(value->getType(), amount, true);<br>
<br>
     // Note that signed integer inc/dec with width less than int can't<br>
     // overflow because of promotion rules; we're just eliding a few steps here.<br>
<br>
Added: cfe/trunk/test/CodeGen/pr13704.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pr13704.c?rev=162766&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pr13704.c?rev=162766&view=auto</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGen/pr13704.c (added)<br>
+++ cfe/trunk/test/CodeGen/pr13704.c Tue Aug 28 11:55:13 2012<br>
@@ -0,0 +1,9 @@<br>
+// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s<br>
+extern void foo(__int128);<br>
+<br>
+void bar() {<br>
+  __int128 x = 2;<br>
+  x--;<br>
+  foo(x);<br>
+// CHECK: add nsw i128 %0, -1<br>
+}</blockquote><div><br></div><div>This test is really small. Can you add this test case to one of the existing codegen tests, with a comment (or namespace, or function name) to indicate that it is derived from PR13704?</div>
<div><br></div><div>The reason we tend to pull many different tests together into a single file is that running the test suite is largely limited on the number of files.</div><div><br></div><div>Thanks!</div></div></div>