[clang] [llvm] [CaptureTracking][FunctionAttrs] Add support for CaptureInfo (PR #125880)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Thu Feb 6 11:23:30 PST 2025
================
@@ -358,49 +363,54 @@ UseCaptureKind llvm::DetermineUseCaptureKind(
// Volatile stores make the address observable.
auto *ACXI = cast<AtomicCmpXchgInst>(I);
if (U.getOperandNo() == 1 || U.getOperandNo() == 2 || ACXI->isVolatile())
- return UseCaptureKind::MAY_CAPTURE;
- return UseCaptureKind::NO_CAPTURE;
+ return CaptureInfo::otherOnly();
+ return CaptureInfo::none();
}
case Instruction::GetElementPtr:
// AA does not support pointers of vectors, so GEP vector splats need to
// be considered as captures.
if (I->getType()->isVectorTy())
- return UseCaptureKind::MAY_CAPTURE;
- return UseCaptureKind::PASSTHROUGH;
+ return CaptureInfo::otherOnly();
+ return CaptureInfo::retOnly();
case Instruction::BitCast:
case Instruction::PHI:
case Instruction::Select:
case Instruction::AddrSpaceCast:
// The original value is not captured via this if the new value isn't.
- return UseCaptureKind::PASSTHROUGH;
+ return CaptureInfo::retOnly();
case Instruction::ICmp: {
unsigned Idx = U.getOperandNo();
unsigned OtherIdx = 1 - Idx;
if (auto *CPN = dyn_cast<ConstantPointerNull>(I->getOperand(OtherIdx))) {
----------------
nikic wrote:
That's a good point. This code is also subtly incorrect for other reasons, but the signed predicate case is blatantly wrong. Not going to touch this now as this be removed altogether soon...
https://github.com/llvm/llvm-project/pull/125880
More information about the cfe-commits
mailing list