[cfe-commits] r165197 - /cfe/trunk/lib/CodeGen/CGExprScalar.cpp

Lang Hames lhames at gmail.com
Wed Oct 3 20:23:25 PDT 2012


Author: lhames
Date: Wed Oct  3 22:23:25 2012
New Revision: 165197

URL: http://llvm.org/viewvc/llvm-project?rev=165197&view=rev
Log:
Fail early with a clear assert if an operation with multiple uses somehow ends
up being contracted during codegen.

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=165197&r1=165196&r2=165197&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Oct  3 22:23:25 2012
@@ -2045,11 +2045,15 @@
   // We have a potentially fusable op. Look for a mul on one of the operands.
   if (llvm::BinaryOperator* LHSBinOp = dyn_cast<llvm::BinaryOperator>(op.LHS)) {
     if (LHSBinOp->getOpcode() == llvm::Instruction::FMul) {
+      assert(LHSBinOp->getNumUses() == 0 &&
+             "Operations with multiple uses shouldn't be contracted.");
       return buildFMulAdd(LHSBinOp, op.RHS, CGF, Builder, false, isSub);
     }
   } else if (llvm::BinaryOperator* RHSBinOp =
                dyn_cast<llvm::BinaryOperator>(op.RHS)) {
     if (RHSBinOp->getOpcode() == llvm::Instruction::FMul) {
+      assert(RHSBinOp->getNumUses() == 0 &&
+             "Operations with multiple uses shouldn't be contracted.");
       return buildFMulAdd(RHSBinOp, op.LHS, CGF, Builder, isSub, false);
     }
   }





More information about the cfe-commits mailing list