[cfe-commits] r162766 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGen/pr13704.c

Michael Liao michael.liao at intel.com
Tue Aug 28 10:48:32 PDT 2012


That test is merged into exprs.c in r162769. - Michael

On Tue, 2012-08-28 at 10:03 -0700, Chandler Carruth wrote:
> On Tue, Aug 28, 2012 at 9:55 AM, Michael Liao <michael.liao at intel.com>
> wrote:
>         Author: hliao
>         Date: Tue Aug 28 11:55:13 2012
>         New Revision: 162766
>         
>         URL: http://llvm.org/viewvc/llvm-project?rev=162766&view=rev
>         Log:
>         Fix PR13704
>         
>         - The increment needs to be signed value to preserve the
>         original value when
>           its data type is larger than 64-bit integer.
> 
> 
> Thanks for the fix! One small comment:
>  
>         Added:
>             cfe/trunk/test/CodeGen/pr13704.c
>         Modified:
>             cfe/trunk/lib/CodeGen/CGExprScalar.cpp
>         
>         Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
>         URL:
>         http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=162766&r1=162765&r2=162766&view=diff
>         ==============================================================================
>         --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
>         +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Tue Aug 28 11:55:13
>         2012
>         @@ -1306,7 +1306,7 @@
>            // Most common case by far: integer increment.
>            } else if (type->isIntegerType()) {
>         
>         -    llvm::Value *amt =
>         llvm::ConstantInt::get(value->getType(), amount);
>         +    llvm::Value *amt =
>         llvm::ConstantInt::get(value->getType(), amount, true);
>         
>              // Note that signed integer inc/dec with width less than
>         int can't
>              // overflow because of promotion rules; we're just
>         eliding a few steps here.
>         
>         Added: cfe/trunk/test/CodeGen/pr13704.c
>         URL:
>         http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/pr13704.c?rev=162766&view=auto
>         ==============================================================================
>         --- cfe/trunk/test/CodeGen/pr13704.c (added)
>         +++ cfe/trunk/test/CodeGen/pr13704.c Tue Aug 28 11:55:13 2012
>         @@ -0,0 +1,9 @@
>         +// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
>         +extern void foo(__int128);
>         +
>         +void bar() {
>         +  __int128 x = 2;
>         +  x--;
>         +  foo(x);
>         +// CHECK: add nsw i128 %0, -1
>         +}
> 
> 
> 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?
> 
> 
> 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.
> 
> 
> Thanks!





More information about the cfe-commits mailing list