Cleanup. No functionality change intended.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 7 Jul 2014 05:36:14 +0000 (05:36 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Mon, 7 Jul 2014 05:36:14 +0000 (05:36 +0000)
llvm-svn: 212432

clang/lib/CodeGen/CGExprScalar.cpp

index 046ee33..a4abc0f 100644 (file)
@@ -1618,12 +1618,11 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV,
 
     // 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.
-    if (value->getType()->getPrimitiveSizeInBits() >=
-            CGF.IntTy->getBitWidth() &&
-        type->isSignedIntegerOrEnumerationType()) {
+    bool CanOverflow = value->getType()->getIntegerBitWidth() >=
+                       CGF.IntTy->getIntegerBitWidth();
+    if (CanOverflow && type->isSignedIntegerOrEnumerationType()) {
       value = EmitAddConsiderOverflowBehavior(E, value, amt, isInc);
-    } else if (value->getType()->getPrimitiveSizeInBits() >=
-               CGF.IntTy->getBitWidth() && type->isUnsignedIntegerType() &&
+    } else if (CanOverflow && type->isUnsignedIntegerType() &&
                CGF.SanOpts->UnsignedIntegerOverflow) {
       BinOpInfo BinOp;
       BinOp.LHS = value;