[llvm-branch-commits] [llvm-branch] r134500 - in /llvm/branches/type-system-rewrite: include/llvm/Constants.h lib/VMCore/Constants.cpp

Chris Lattner sabre at nondot.org
Wed Jul 6 10:22:10 PDT 2011


Author: lattner
Date: Wed Jul  6 12:22:10 2011
New Revision: 134500

URL: http://llvm.org/viewvc/llvm-project?rev=134500&view=rev
Log:
relax assertion in ConstantExpr::getWithOperands.  It can take operands of
different types now, fixing a linker testcase assertion.


Modified:
    llvm/branches/type-system-rewrite/include/llvm/Constants.h
    llvm/branches/type-system-rewrite/lib/VMCore/Constants.cpp

Modified: llvm/branches/type-system-rewrite/include/llvm/Constants.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/type-system-rewrite/include/llvm/Constants.h?rev=134500&r1=134499&r2=134500&view=diff
==============================================================================
--- llvm/branches/type-system-rewrite/include/llvm/Constants.h (original)
+++ llvm/branches/type-system-rewrite/include/llvm/Constants.h Wed Jul  6 12:22:10 2011
@@ -912,8 +912,8 @@
   Constant *getWithOperandReplaced(unsigned OpNo, Constant *Op) const;
   
   /// getWithOperands - This returns the current constant expression with the
-  /// operands replaced with the specified values.  The specified operands must
-  /// match count and type with the existing ones.
+  /// operands replaced with the specified values.  The specified array must
+  /// have the same number of operands as our current one.
   Constant *getWithOperands(ArrayRef<Constant*> Ops) const;
   
   virtual void destroyConstant();

Modified: llvm/branches/type-system-rewrite/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/type-system-rewrite/lib/VMCore/Constants.cpp?rev=134500&r1=134499&r2=134500&view=diff
==============================================================================
--- llvm/branches/type-system-rewrite/lib/VMCore/Constants.cpp (original)
+++ llvm/branches/type-system-rewrite/lib/VMCore/Constants.cpp Wed Jul  6 12:22:10 2011
@@ -839,17 +839,15 @@
 }
 
 /// getWithOperands - This returns the current constant expression with the
-/// operands replaced with the specified values.  The specified operands must
-/// match count and type with the existing ones.
+/// operands replaced with the specified values.  The specified array must
+/// have the same number of operands as our current one.
 Constant *ConstantExpr::
 getWithOperands(ArrayRef<Constant*> Ops) const {
   assert(Ops.size() == getNumOperands() && "Operand count mismatch!");
   bool AnyChange = false;
-  for (unsigned i = 0; i != Ops.size(); ++i) {
-    assert(Ops[i]->getType() == getOperand(i)->getType() &&
-           "Operand type mismatch!");
+  for (unsigned i = 0; i != Ops.size(); ++i)
     AnyChange |= Ops[i] != getOperand(i);
-  }
+  
   if (!AnyChange)  // No operands changed, return self.
     return const_cast<ConstantExpr*>(this);
 





More information about the llvm-branch-commits mailing list