[llvm] Fix for failing test from fdbd84c6c8

When handling a DSOLocalEquivalent operand change:

- Remove assertion checking that the `To` type and current type are the
  same type. This is not always a requirement.
- Add a missing bitcast from an old DSOLocalEquivalent to the type of
  the new one.
This commit is contained in:
Leonard Chan 2020-12-01 15:45:07 -08:00
parent 6c3fa97d8a
commit 19bdc8e5a3
1 changed files with 1 additions and 2 deletions

View File

@ -1851,7 +1851,6 @@ void DSOLocalEquivalent::destroyConstantImpl() {
Value *DSOLocalEquivalent::handleOperandChangeImpl(Value *From, Value *To) {
assert(From == getGlobalValue() && "Changing value does not match operand.");
assert(To->getType() == getType() && "Mismatched types");
assert(isa<Constant>(To) && "Can only replace the operands with a constant");
// The replacement is with another global value.
@ -1859,7 +1858,7 @@ Value *DSOLocalEquivalent::handleOperandChangeImpl(Value *From, Value *To) {
DSOLocalEquivalent *&NewEquiv =
getContext().pImpl->DSOLocalEquivalents[ToObj];
if (NewEquiv)
return NewEquiv;
return llvm::ConstantExpr::getBitCast(NewEquiv, getType());
}
// If the argument is replaced with a null value, just replace this constant