Skip to content

Commit

Permalink
only skip memcpy in runOnUpgradeableConstantCasts (#1312)
Browse files Browse the repository at this point in the history
We what to upgrade all other function. Especially the calls ending up
on atomics operation
  • Loading branch information
rjodinchr authored Mar 7, 2024
1 parent 1d7ba90 commit c9d2022
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions lib/SimplifyPointerBitcastPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,19 @@ bool clspv::SimplifyPointerBitcastPass::runOnUpgradeableConstantCasts(
Value *source = nullptr;
Type *source_ty = nullptr;
Type *dest_ty = nullptr;
// calls like memcpy cannot be simplify by this function, skip them to
// avoid having to support them in function like
// `BitcastUtils::PointerOperandNum`.

auto isMemcpy = [](Instruction *I) {
auto memcpy = dyn_cast<CallInst>(I);
if (memcpy == nullptr)
return false;
return memcpy->getCalledFunction()->getIntrinsicID() ==
Intrinsic::memcpy;
};
// memcpy cannot be simplify by this function, skip them to avoid having
// to support them in function like `BitcastUtils::PointerOperandNum`.
if (!IsImplicitCasts(M, type_cache, I, source, source_ty, dest_ty,
true) ||
dyn_cast<CallInst>(&I)) {
isMemcpy(&I)) {
continue;
}

Expand Down

0 comments on commit c9d2022

Please sign in to comment.