Handle null values when handling operand changes for DSOLocalEquivalent.
return NewEquiv;
}
+ // If the argument is replaced with a null value, just replace this constant
+ // with a null value.
+ if (cast<Constant>(To)->isNullValue())
+ return To;
+
// The replacement could be a bitcast or an alias to another function. We can
// replace it with a bitcast to the dso_local_equivalent of that function.
auto *Func = cast<Function>(To->stripPointerCastsAndAliases());