Fix another bug that was causing siod to fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44325 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-11-26 07:17:19 +00:00
parent 97d4e51df1
commit a16bbc9aa7

View File

@ -150,6 +150,7 @@ namespace {
void erase(Value* v);
unsigned size();
void setAliasAnalysis(AliasAnalysis* A) { AA = A; }
uint32_t hash_operand(Value* v);
};
}
@ -338,6 +339,15 @@ Expression::ExpressionOpcode
}
}
uint32_t ValueTable::hash_operand(Value* v) {
if (CallInst* CI = dyn_cast<CallInst>(v))
if (CI->getCalledFunction() &&
!AA->doesNotAccessMemory(CI->getCalledFunction()))
return nextValueNumber++;
return lookup_or_add(v);
}
Expression ValueTable::create_expression(CallInst* C) {
Expression e;
@ -350,7 +360,7 @@ Expression ValueTable::create_expression(CallInst* C) {
for (CallInst::op_iterator I = C->op_begin()+1, E = C->op_end();
I != E; ++I)
e.varargs.push_back(lookup_or_add(*I));
e.varargs.push_back(hash_operand(*I));
return e;
}
@ -358,8 +368,8 @@ Expression ValueTable::create_expression(CallInst* C) {
Expression ValueTable::create_expression(BinaryOperator* BO) {
Expression e;
e.firstVN = lookup_or_add(BO->getOperand(0));
e.secondVN = lookup_or_add(BO->getOperand(1));
e.firstVN = hash_operand(BO->getOperand(0));
e.secondVN = hash_operand(BO->getOperand(1));
e.thirdVN = 0;
e.function = 0;
e.type = BO->getType();
@ -371,8 +381,8 @@ Expression ValueTable::create_expression(BinaryOperator* BO) {
Expression ValueTable::create_expression(CmpInst* C) {
Expression e;
e.firstVN = lookup_or_add(C->getOperand(0));
e.secondVN = lookup_or_add(C->getOperand(1));
e.firstVN = hash_operand(C->getOperand(0));
e.secondVN = hash_operand(C->getOperand(1));
e.thirdVN = 0;
e.function = 0;
e.type = C->getType();
@ -384,7 +394,7 @@ Expression ValueTable::create_expression(CmpInst* C) {
Expression ValueTable::create_expression(CastInst* C) {
Expression e;
e.firstVN = lookup_or_add(C->getOperand(0));
e.firstVN = hash_operand(C->getOperand(0));
e.secondVN = 0;
e.thirdVN = 0;
e.function = 0;
@ -397,9 +407,9 @@ Expression ValueTable::create_expression(CastInst* C) {
Expression ValueTable::create_expression(ShuffleVectorInst* S) {
Expression e;
e.firstVN = lookup_or_add(S->getOperand(0));
e.secondVN = lookup_or_add(S->getOperand(1));
e.thirdVN = lookup_or_add(S->getOperand(2));
e.firstVN = hash_operand(S->getOperand(0));
e.secondVN = hash_operand(S->getOperand(1));
e.thirdVN = hash_operand(S->getOperand(2));
e.function = 0;
e.type = S->getType();
e.opcode = Expression::SHUFFLE;
@ -410,8 +420,8 @@ Expression ValueTable::create_expression(ShuffleVectorInst* S) {
Expression ValueTable::create_expression(ExtractElementInst* E) {
Expression e;
e.firstVN = lookup_or_add(E->getOperand(0));
e.secondVN = lookup_or_add(E->getOperand(1));
e.firstVN = hash_operand(E->getOperand(0));
e.secondVN = hash_operand(E->getOperand(1));
e.thirdVN = 0;
e.function = 0;
e.type = E->getType();
@ -423,9 +433,9 @@ Expression ValueTable::create_expression(ExtractElementInst* E) {
Expression ValueTable::create_expression(InsertElementInst* I) {
Expression e;
e.firstVN = lookup_or_add(I->getOperand(0));
e.secondVN = lookup_or_add(I->getOperand(1));
e.thirdVN = lookup_or_add(I->getOperand(2));
e.firstVN = hash_operand(I->getOperand(0));
e.secondVN = hash_operand(I->getOperand(1));
e.thirdVN = hash_operand(I->getOperand(2));
e.function = 0;
e.type = I->getType();
e.opcode = Expression::INSERT;
@ -436,9 +446,9 @@ Expression ValueTable::create_expression(InsertElementInst* I) {
Expression ValueTable::create_expression(SelectInst* I) {
Expression e;
e.firstVN = lookup_or_add(I->getCondition());
e.secondVN = lookup_or_add(I->getTrueValue());
e.thirdVN = lookup_or_add(I->getFalseValue());
e.firstVN = hash_operand(I->getCondition());
e.secondVN = hash_operand(I->getTrueValue());
e.thirdVN = hash_operand(I->getFalseValue());
e.function = 0;
e.type = I->getType();
e.opcode = Expression::SELECT;
@ -449,7 +459,7 @@ Expression ValueTable::create_expression(SelectInst* I) {
Expression ValueTable::create_expression(GetElementPtrInst* G) {
Expression e;
e.firstVN = lookup_or_add(G->getPointerOperand());
e.firstVN = hash_operand(G->getPointerOperand());
e.secondVN = 0;
e.thirdVN = 0;
e.function = 0;
@ -458,7 +468,7 @@ Expression ValueTable::create_expression(GetElementPtrInst* G) {
for (GetElementPtrInst::op_iterator I = G->idx_begin(), E = G->idx_end();
I != E; ++I)
e.varargs.push_back(lookup_or_add(*I));
e.varargs.push_back(hash_operand(*I));
return e;
}