]> granicus.if.org Git - clang/commitdiff
Clean up some code to use isZero instead of calling getZExtValue.
authorChris Lattner <sabre@nondot.org>
Wed, 12 Nov 2008 04:54:14 +0000 (04:54 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 12 Nov 2008 04:54:14 +0000 (04:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59103 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGExprScalar.cpp
lib/CodeGen/CGStmt.cpp

index 6077f8e61c185b778496c35705eb7dfac422d320..1a583a71584ccab1b4ebc65a4cd973de8a684eb0 100644 (file)
@@ -1022,7 +1022,7 @@ Value *ScalarExprEmitter::VisitBinLAnd(const BinaryOperator *E) {
   
   if (llvm::ConstantInt *LHSCst = dyn_cast<llvm::ConstantInt>(LHSCond)) {
     // If we have 0 && RHS, see if we can elide RHS, if so, just return LHSCond.
-    if (LHSCst->getZExtValue() == 0) {
+    if (LHSCst->isZero()) {
       if (!CGF.ContainsLabel(E->getRHS()))
         // Elide RHS, return 0
         return llvm::Constant::getNullValue(CGF.LLVMIntTy);
@@ -1063,7 +1063,7 @@ Value *ScalarExprEmitter::VisitBinLOr(const BinaryOperator *E) {
   
   if (llvm::ConstantInt *LHSCst = dyn_cast<llvm::ConstantInt>(LHSCond)) {
     // If we have 1 || RHS, see if we can elide RHS, if so, just return LHSCond.
-    if (LHSCst->getZExtValue() != 0) {
+    if (!LHSCst->isZero()) {
       if (!CGF.ContainsLabel(E->getRHS()))
         // Elide RHS, return 1
         return llvm::ConstantInt::get(CGF.LLVMIntTy, 1);
@@ -1120,7 +1120,7 @@ VisitConditionalOperator(const ConditionalOperator *E) {
   // can't do this if the dead side contains a label.
   if (llvm::ConstantInt *CondCI = dyn_cast<llvm::ConstantInt>(CondVal)) {
     Expr *Live = E->getLHS(), *Dead = E->getRHS();
-    if (CondCI->getZExtValue() == 0)
+    if (CondCI->isZero())
       std::swap(Live, Dead);
     if (!Dead || !CGF.ContainsLabel(Dead)) {
       // Emit the live side.
index daad3f5e7988ad05fd74b1c9791de7c058171087..7f9ca7af7fef2b553a1b52f948b18ddee12de11b 100644 (file)
@@ -233,7 +233,7 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) {
   if (llvm::ConstantInt *CondCst = dyn_cast<llvm::ConstantInt>(BoolCondVal)) {
     // Figure out which block (then or else) is executed.
     const Stmt *Executed = S.getThen(), *Skipped  = S.getElse();
-    if (!CondCst->getZExtValue())
+    if (CondCst->isZero())
       std::swap(Executed, Skipped);
 
     // If the skipped block has no labels in it, just emit the executed block.