File tree Expand file tree Collapse file tree 2 files changed +15
-18
lines changed
Expand file tree Collapse file tree 2 files changed +15
-18
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,18 @@ class BranchPropagatedUser {
108108 llvm::PointerLikeTypeTraits<InnerTy>::NumLowBitsAvailable
109109 };
110110
111+ static ArrayRef<BranchPropagatedUser>
112+ convertFromInstArray (ArrayRef<SILInstruction *> instArray) {
113+ assert (llvm::all_of (
114+ instArray,
115+ [](SILInstruction *i) { return !isa<CondBranchInst>(i); }) &&
116+ " Passed cond branch to a non-BranchPropagatedUser API" );
117+ auto *castData =
118+ reinterpret_cast <const BranchPropagatedUser *>(instArray.data ());
119+ ArrayRef<BranchPropagatedUser> castArray (castData, instArray.size ());
120+ return castArray;
121+ }
122+
111123private:
112124 BranchPropagatedUser (SILInstruction *inst) : user(inst) {
113125 assert (!isa<CondBranchInst>(inst));
Original file line number Diff line number Diff line change @@ -187,24 +187,9 @@ class LinearLifetimeChecker {
187187 bool validateLifetime (SILValue value,
188188 ArrayRef<SILInstruction *> consumingUses,
189189 ArrayRef<SILInstruction *> nonConsumingUses) {
190- assert (llvm::all_of (
191- consumingUses,
192- [](SILInstruction *i) { return !isa<CondBranchInst>(i); }) &&
193- " Passed cond branch to a non-BranchPropagatedUser API" );
194- assert (llvm::all_of (
195- nonConsumingUses,
196- [](SILInstruction *i) { return !isa<CondBranchInst>(i); }) &&
197- " Passed cond branch to a non-BranchPropagatedUser API" );
198- auto *consumingUsesCast =
199- reinterpret_cast <const BranchPropagatedUser *>(consumingUses.data ());
200- auto *nonConsumingUsesCast =
201- reinterpret_cast <const BranchPropagatedUser *>(nonConsumingUses.data ());
202- ArrayRef<BranchPropagatedUser> consumingUsesCastArray (consumingUsesCast,
203- consumingUses.size ());
204- ArrayRef<BranchPropagatedUser> nonConsumingUsesCastArray (
205- nonConsumingUsesCast, nonConsumingUses.size ());
206- return validateLifetime (value, consumingUsesCastArray,
207- nonConsumingUsesCastArray);
190+ return validateLifetime (
191+ value, BranchPropagatedUser::convertFromInstArray (consumingUses),
192+ BranchPropagatedUser::convertFromInstArray (nonConsumingUses));
208193 }
209194};
210195
You can’t perform that action at this time.
0 commit comments