mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Change SILCloner to be able to remap additional non-instruction based SILValues such as SILUndef.
Previously we only supported SILArguments. In the process of changing this I noticed that our densemap implementation for SILValues only hashes the wrapped ValueBase instead of hash combining that hash with a hash of the result number. The main use case for this is to enable the insertion of a Builtin.trap + RAUW SILUndef of uses of an unconditional_checked_cast that is invalid after specialization. rdar://16490450 Swift SVN r15747
This commit is contained in:
@@ -118,7 +118,7 @@ protected:
|
||||
|
||||
SILBuilder Builder;
|
||||
SILBasicBlock *InsertBeforeBB;
|
||||
llvm::DenseMap<ValueBase*, SILValue> ValueMap;
|
||||
llvm::DenseMap<SILValue, SILValue> ValueMap;
|
||||
llvm::DenseMap<SILInstruction*, SILInstruction*> InstructionMap;
|
||||
llvm::DenseMap<SILBasicBlock*, SILBasicBlock*> BBMap;
|
||||
TypeSubstitutionMap OpenedExistentialSubs;
|
||||
@@ -127,12 +127,9 @@ protected:
|
||||
template<typename ImplClass>
|
||||
SILValue
|
||||
SILCloner<ImplClass>::remapValue(SILValue Value) {
|
||||
auto VI = ValueMap.find(Value.getDef());
|
||||
if (VI != ValueMap.end()) {
|
||||
assert(Value.getResultNumber() == 0 &&
|
||||
"Non-zero result number of mapped value used?");
|
||||
auto VI = ValueMap.find(Value);
|
||||
if (VI != ValueMap.end())
|
||||
return VI->second;
|
||||
}
|
||||
|
||||
if (SILInstruction* I = dyn_cast<SILInstruction>(Value.getDef())) {
|
||||
auto II = InstructionMap.find(I);
|
||||
|
||||
Reference in New Issue
Block a user