[cfe-commits] r124153 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp lib/Sema/SemaExpr.cpp test/CodeGen/builtins-ppc-altivec.c test/SemaCXX/altivec.cpp

Anton Yartsev anton.yartsev at gmail.com
Fri Feb 4 19:19:00 PST 2011


On 25.01.2011 2:07, Eric Christopher wrote:
> Author: echristo
> Date: Mon Jan 24 17:07:03 2011
> New Revision: 124153
>
> URL: http://llvm.org/viewvc/llvm-project?rev=124153&view=rev
> Log:
> Revert r124146 for now. It appears to be failing on a few platforms.
>
> Modified:
>      cfe/trunk/lib/CodeGen/CGExprScalar.cpp
>      cfe/trunk/lib/Sema/SemaExpr.cpp
>      cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
>      cfe/trunk/test/SemaCXX/altivec.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=124153&r1=124152&r2=124153&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Mon Jan 24 17:07:03 2011
> @@ -302,11 +302,6 @@
>       return EmitScalarPrePostIncDec(E, LV, true, true);
>     }
>
> -  llvm::Value *EmitAddConsiderOverflowBehavior(const UnaryOperator *E,
> -                                               llvm::Value *InVal,
> -                                               llvm::Value *NextVal,
> -                                               bool IsInc);
> -
>     llvm::Value *EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
>                                          bool isInc, bool isPre);
>
> @@ -1227,31 +1222,6 @@
>   //===----------------------------------------------------------------------===//
>
>   llvm::Value *ScalarExprEmitter::
> -EmitAddConsiderOverflowBehavior(const UnaryOperator *E,
> -                                llvm::Value *InVal,
> -                                llvm::Value *NextVal, bool IsInc) {
> -  switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) {
> -  case LangOptions::SOB_Undefined:
> -    return Builder.CreateNSWAdd(InVal, NextVal, IsInc ? "inc" : "dec");
> -    break;
> -  case LangOptions::SOB_Defined:
> -    return Builder.CreateAdd(InVal, NextVal, IsInc ? "inc" : "dec");
> -    break;
> -  case LangOptions::SOB_Trapping:
> -    BinOpInfo BinOp;
> -    BinOp.LHS = InVal;
> -    BinOp.RHS = NextVal;
> -    BinOp.Ty = E->getType();
> -    BinOp.Opcode = BO_Add;
> -    BinOp.E = E;
> -    return EmitOverflowCheckedBinOp(BinOp);
> -    break;
> -  }
> -  assert(false&&  "Unknown SignedOverflowBehaviorTy");
> -  return 0;
> -}
> -
> -llvm::Value *ScalarExprEmitter::
>   EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
>                           bool isInc, bool isPre) {
>
> @@ -1300,26 +1270,31 @@
>       // An interesting aspect of this is that increment is always true.
>       // Decrement does not have this property.
>       NextVal = llvm::ConstantInt::getTrue(VMContext);
> -  } else if (ValTy->isVectorType()) {
> -    if (ValTy->hasIntegerRepresentation()) {
> -      NextVal = llvm::ConstantInt::get(InVal->getType(), AmountVal);
> -
> -      NextVal = ValTy->hasSignedIntegerRepresentation() ?
> -                EmitAddConsiderOverflowBehavior(E, InVal, NextVal, isInc) :
> -                Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
> -    } else {
> -      NextVal = Builder.CreateFAdd(
> -                  InVal,
> -                  llvm::ConstantFP::get(InVal->getType(), AmountVal),
> -                  isInc ? "inc" : "dec");
> -    }
>     } else if (isa<llvm::IntegerType>(InVal->getType())) {
>       NextVal = llvm::ConstantInt::get(InVal->getType(), AmountVal);
> -
> -    NextVal = ValTy->isSignedIntegerType() ?
> -              EmitAddConsiderOverflowBehavior(E, InVal, NextVal, isInc) :
> -              // Unsigned integer inc is always two's complement.
> -              Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
> +
> +    if (!ValTy->isSignedIntegerType())
> +      // Unsigned integer inc is always two's complement.
> +      NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
> +    else {
> +      switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) {
> +      case LangOptions::SOB_Undefined:
> +        NextVal = Builder.CreateNSWAdd(InVal, NextVal, isInc ? "inc" : "dec");
> +        break;
> +      case LangOptions::SOB_Defined:
> +        NextVal = Builder.CreateAdd(InVal, NextVal, isInc ? "inc" : "dec");
> +        break;
> +      case LangOptions::SOB_Trapping:
> +        BinOpInfo BinOp;
> +        BinOp.LHS = InVal;
> +        BinOp.RHS = NextVal;
> +        BinOp.Ty = E->getType();
> +        BinOp.Opcode = BO_Add;
> +        BinOp.E = E;
> +        NextVal = EmitOverflowCheckedBinOp(BinOp);
> +        break;
> +      }
> +    }
>     } else {
>       // Add the inc/dec to the real part.
>       if (InVal->getType()->isFloatTy())
>
> Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=124153&r1=124152&r2=124153&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Jan 24 17:07:03 2011
> @@ -7081,8 +7081,6 @@
>       if (PR.isInvalid()) return QualType();
>       return CheckIncrementDecrementOperand(S, PR.take(), VK, OpLoc,
>                                             isInc, isPrefix);
> -  } else if (S.getLangOptions().AltiVec&&  ResType->isVectorType()) {
> -    // OK! ( C/C++ Language Extensions for CBEA(Version 2.6) 10.3 )
>     } else {
>       S.Diag(OpLoc, diag::err_typecheck_illegal_increment_decrement)
>         <<  ResType<<  int(isInc)<<  Op->getSourceRange();
>
> Modified: cfe/trunk/test/CodeGen/builtins-ppc-altivec.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtins-ppc-altivec.c?rev=124153&r1=124152&r2=124153&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGen/builtins-ppc-altivec.c (original)
> +++ cfe/trunk/test/CodeGen/builtins-ppc-altivec.c Mon Jan 24 17:07:03 2011
> @@ -3113,14 +3113,3 @@
>     res_i = (vf1<= vf2);                    // CHECK: @llvm.ppc.altivec.vcmpgefp.p(i32 2
>     res_i = (vf1>= vf2);                    // CHECK: @llvm.ppc.altivec.vcmpgefp.p(i32 2
>   }
> -
> -/* ------------------------------- increment/decrement: ----------------------------- */
> -// CHECK: define void @test8
> -void test8() {
> -  vector int vi;
> -  vi++;                                    // CHECK: add nsw<4 x i32>  {{.*}}<i32 1, i32 1, i32 1, i32 1>
> -  vector unsigned int vui;
> -  --vui;                                   // CHECK: add<4 x i32>  {{.*}}<i32 -1, i32 -1, i32 -1, i32 -1>
> -  vector float vf;
> -  vf++;                                    // CHECK: fadd<4 x float>  {{.*}}<float 1.000000e+000, float 1.000000e+000, float 1.000000e+000, float 1.000000e+000>
> -}
>
> Modified: cfe/trunk/test/SemaCXX/altivec.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/altivec.cpp?rev=124153&r1=124152&r2=124153&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/altivec.cpp (original)
> +++ cfe/trunk/test/SemaCXX/altivec.cpp Mon Jan 24 17:07:03 2011
> @@ -6,7 +6,7 @@
>   {
>   }
>
> -void test1()
> +void test()
>   {
>     V4i vGCC;
>     vector int vAltiVec;
> @@ -16,24 +16,3 @@
>     bool res = vGCC>  vAltiVec;
>     vAltiVec = 0 ? vGCC : vGCC;
>   }
> -
> -template<typename T>
> -void template_f(T param) {
> -  param++;
> -}
> -
> -void test2()
> -{
> -  vector int vi;
> -  ++vi;
> -  vi++;
> -  --vi;
> -  vi--;
> -  vector float vf;
> -  vf++;
> -
> -  ++vi=vi;
> -  vi++=vi;         // expected-error {{expression is not assignable}}
> -  (++vi)[1]=1;
> -  template_f(vi);
> -}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
Hi Eric,

could you please provide any information on the problem? which platform 
and what kind of failure was it?

-- 
Anton




More information about the cfe-commits mailing list