[cfe-commits] r68330 - in /cfe/trunk: include/clang/Basic/LangOptions.h include/clang/Driver/Options.def lib/CodeGen/CGExprScalar.cpp test/CodeGen/trapu.c tools/clang-cc/clang-cc.cpp
Mike Stump
mrs at apple.com
Thu Apr 2 11:15:54 PDT 2009
Author: mrs
Date: Thu Apr 2 13:15:54 2009
New Revision: 68330
URL: http://llvm.org/viewvc/llvm-project?rev=68330&view=rev
Log:
Remove -ftrapu.
Removed:
cfe/trunk/test/CodeGen/trapu.c
Modified:
cfe/trunk/include/clang/Basic/LangOptions.h
cfe/trunk/include/clang/Driver/Options.def
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/include/clang/Basic/LangOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/LangOptions.h?rev=68330&r1=68329&r2=68330&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/LangOptions.h (original)
+++ cfe/trunk/include/clang/Basic/LangOptions.h Thu Apr 2 13:15:54 2009
@@ -59,10 +59,6 @@
unsigned MathErrno : 1; // Math functions must respect errno
// (modulo the platform support).
- unsigned UnsignedOverflowChecking : 1;
- // Extension to call a handler function when
- // unsigned and signed integer arithmetic overflows.
-
unsigned OverflowChecking : 1; // Extension to call a handler function when
// signed integer arithmetic overflows.
@@ -94,7 +90,6 @@
EmitAllDecls = 0;
MathErrno = 1;
- UnsignedOverflowChecking = 0;
OverflowChecking = 0;
InstantiationDepth = 99;
Modified: cfe/trunk/include/clang/Driver/Options.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.def?rev=68330&r1=68329&r2=68330&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Options.def (original)
+++ cfe/trunk/include/clang/Driver/Options.def Thu Apr 2 13:15:54 2009
@@ -448,7 +448,6 @@
OPTION("-fterminated-vtables", fterminated_vtables, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-ftime-report", ftime_report, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-ftraditional", ftraditional, Flag, f_Group, INVALID, "", 0, 0, 0)
-OPTION("-ftrapu", ftrapu, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-ftrapv", ftrapv, Flag, clang_f_Group, INVALID, "", 0, 0, 0)
OPTION("-funwind-tables", funwind_tables, Flag, f_Group, INVALID, "", 0, 0, 0)
OPTION("-fverbose-asm", fverbose_asm, Flag, f_Group, INVALID, "", 0, 0, 0)
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=68330&r1=68329&r2=68330&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Thu Apr 2 13:15:54 2009
@@ -262,9 +262,8 @@
// Binary Operators.
Value *EmitMul(const BinOpInfo &Ops) {
- if (CGF.getContext().getLangOptions().UnsignedOverflowChecking
- || (CGF.getContext().getLangOptions().OverflowChecking
- && Ops.Ty->isSignedIntegerType()))
+ if (CGF.getContext().getLangOptions().OverflowChecking
+ && Ops.Ty->isSignedIntegerType())
return EmitOverflowCheckedBinOp(Ops);
return Builder.CreateMul(Ops.LHS, Ops.RHS, "mul");
}
@@ -837,54 +836,28 @@
unsigned IID;
unsigned OpID = 0;
- if (Ops.Ty->isSignedIntegerType()) {
- switch (Ops.E->getOpcode()) {
- case BinaryOperator::Add:
- case BinaryOperator::AddAssign:
- OpID = 1;
- IID = llvm::Intrinsic::sadd_with_overflow;
- break;
- case BinaryOperator::Sub:
- case BinaryOperator::SubAssign:
- OpID = 2;
- IID = llvm::Intrinsic::ssub_with_overflow;
- break;
- case BinaryOperator::Mul:
- case BinaryOperator::MulAssign:
- OpID = 3;
- IID = llvm::Intrinsic::smul_with_overflow;
- break;
- default:
- fprintf(stderr, "Opcode: %d\n", Ops.E->getOpcode());
- assert(false && "Unsupported operation for overflow detection");
- }
- OpID <<= 1;
- OpID |= 1;
- }
- else {
- assert(Ops.Ty->isUnsignedIntegerType() &&
- "Must be either a signed or unsigned integer op");
- switch (Ops.E->getOpcode()) {
- case BinaryOperator::Add:
- case BinaryOperator::AddAssign:
- OpID = 1;
- IID = llvm::Intrinsic::uadd_with_overflow;
- break;
- case BinaryOperator::Sub:
- case BinaryOperator::SubAssign:
- OpID = 2;
- IID = llvm::Intrinsic::usub_with_overflow;
- break;
- case BinaryOperator::Mul:
- case BinaryOperator::MulAssign:
- OpID = 3;
- IID = llvm::Intrinsic::umul_with_overflow;
- break;
- default:
- assert(false && "Unsupported operation for overflow detection");
- }
- OpID <<= 1;
+ switch (Ops.E->getOpcode()) {
+ case BinaryOperator::Add:
+ case BinaryOperator::AddAssign:
+ OpID = 1;
+ IID = llvm::Intrinsic::sadd_with_overflow;
+ break;
+ case BinaryOperator::Sub:
+ case BinaryOperator::SubAssign:
+ OpID = 2;
+ IID = llvm::Intrinsic::ssub_with_overflow;
+ break;
+ case BinaryOperator::Mul:
+ case BinaryOperator::MulAssign:
+ OpID = 3;
+ IID = llvm::Intrinsic::smul_with_overflow;
+ break;
+ default:
+ assert(false && "Unsupported operation for overflow detection");
}
+ OpID <<= 1;
+ OpID |= 1;
+
const llvm::Type *opTy = CGF.CGM.getTypes().ConvertType(Ops.Ty);
llvm::Function *intrinsic = CGF.CGM.getIntrinsic(IID, &opTy, 1);
@@ -945,9 +918,8 @@
Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) {
if (!Ops.Ty->isPointerType()) {
- if (CGF.getContext().getLangOptions().UnsignedOverflowChecking
- || (CGF.getContext().getLangOptions().OverflowChecking
- && Ops.Ty->isSignedIntegerType()))
+ if (CGF.getContext().getLangOptions().OverflowChecking
+ && Ops.Ty->isSignedIntegerType())
return EmitOverflowCheckedBinOp(Ops);
return Builder.CreateAdd(Ops.LHS, Ops.RHS, "add");
}
@@ -998,9 +970,8 @@
Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) {
if (!isa<llvm::PointerType>(Ops.LHS->getType())) {
- if (CGF.getContext().getLangOptions().UnsignedOverflowChecking
- || (CGF.getContext().getLangOptions().OverflowChecking
- && Ops.Ty->isSignedIntegerType()))
+ if (CGF.getContext().getLangOptions().OverflowChecking
+ && Ops.Ty->isSignedIntegerType())
return EmitOverflowCheckedBinOp(Ops);
return Builder.CreateSub(Ops.LHS, Ops.RHS, "sub");
}
Removed: cfe/trunk/test/CodeGen/trapu.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/trapu.c?rev=68329&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/trapu.c (original)
+++ cfe/trunk/test/CodeGen/trapu.c (removed)
@@ -1,10 +0,0 @@
-// RUN: clang-cc -ftrapu %s -emit-llvm -o %t &&
-// RUN: grep "__overflow_handler" %t | count 3
-
-unsigned int ui, uj, uk;
-int i, j, k;
-
-void foo() {
- ui = uj + uk;
- i = j + k;
-}
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=68330&r1=68329&r2=68330&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Thu Apr 2 13:15:54 2009
@@ -680,18 +680,12 @@
}
static llvm::cl::opt<bool>
-UnsignedOverflowChecking("ftrapu",
- llvm::cl::desc("Trap on unsigned and signed integer overflow"),
- llvm::cl::init(false));
-
-static llvm::cl::opt<bool>
OverflowChecking("ftrapv",
- llvm::cl::desc("Trap on signed integer overflow"),
+ llvm::cl::desc("Trap on integer overflow"),
llvm::cl::init(false));
void InitializeOverflowChecking(LangOptions &Options) {
- Options.OverflowChecking = OverflowChecking | UnsignedOverflowChecking;
- Options.UnsignedOverflowChecking = UnsignedOverflowChecking;
+ Options.OverflowChecking = OverflowChecking;
}
//===----------------------------------------------------------------------===//
// Target Triple Processing.
More information about the cfe-commits
mailing list