forked from OSchip/llvm-project
[MemoryLocation] Move DSE intrinsic handling to MemoryLocation. (NFC)
Suggested in D114872.
This commit is contained in:
parent
71405d90f0
commit
ead3979a92
|
@ -130,8 +130,19 @@ MemoryLocation MemoryLocation::getForDest(const AnyMemIntrinsic *MI) {
|
|||
|
||||
Optional<MemoryLocation>
|
||||
MemoryLocation::getForDest(const CallBase *CB, const TargetLibraryInfo &TLI) {
|
||||
if (auto *MemInst = dyn_cast<AnyMemIntrinsic>(CB))
|
||||
return getForDest(MemInst);
|
||||
if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(CB)) {
|
||||
if (auto *MemInst = dyn_cast<AnyMemIntrinsic>(CB))
|
||||
return getForDest(MemInst);
|
||||
|
||||
switch (II->getIntrinsicID()) {
|
||||
default:
|
||||
return None;
|
||||
case Intrinsic::init_trampoline:
|
||||
return MemoryLocation::getForArgument(CB, 0, TLI);
|
||||
case Intrinsic::masked_store:
|
||||
return MemoryLocation::getForArgument(CB, 1, TLI);
|
||||
}
|
||||
}
|
||||
|
||||
LibFunc LF;
|
||||
if (TLI.getLibFunc(*CB, LF) && TLI.has(LF)) {
|
||||
|
|
|
@ -1032,15 +1032,6 @@ struct DSEState {
|
|||
!CB->onlyAccessesInaccessibleMemOrArgMem())
|
||||
return None;
|
||||
|
||||
switch (CB->getIntrinsicID()) {
|
||||
case Intrinsic::init_trampoline:
|
||||
return {MemoryLocation::getAfter(CB->getArgOperand(0))};
|
||||
case Intrinsic::masked_store:
|
||||
return {MemoryLocation::getForArgument(CB, 1, TLI)};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return MemoryLocation::getForDest(CB, TLI);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue