Skip to content

Revert "Reapply [hwasan] Update dbg.assign intrinsics in HWAsan pass … #79186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions llvm/lib/IR/DebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2211,6 +2211,10 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
if (F.hasFnAttribute(Attribute::OptimizeNone))
return /*Changed*/ false;

// FIXME: https://github.com/llvm/llvm-project/issues/76545
if (F.hasFnAttribute(Attribute::SanitizeHWAddress))
return /*Changed*/ false;

bool Changed = false;
auto *DL = &F.getParent()->getDataLayout();
// Collect a map of {backing storage : dbg.declares} (currently "backing
Expand Down
5 changes: 0 additions & 5 deletions llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1435,11 +1435,6 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
if (DDI->getVariableLocationOp(LocNo) == AI)
DDI->setExpression(DIExpression::appendOpsToArg(DDI->getExpression(),
NewOps, LocNo));
if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(DDI)) {
if (DAI->getAddress() == AI)
DAI->setAddressExpression(DIExpression::prependOpcodes(
DAI->getAddressExpression(), NewOps));
}
}

auto TagEnd = [&](Instruction *Node) {
Expand Down
10 changes: 3 additions & 7 deletions llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,16 @@ void StackInfoBuilder::visit(Instruction &Inst) {
return;
}
if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&Inst)) {
auto AddIfInteresting = [&](Value *V) {
for (Value *V : DVI->location_ops()) {
if (auto *AI = dyn_cast_or_null<AllocaInst>(V)) {
if (!isInterestingAlloca(*AI))
return;
continue;
AllocaInfo &AInfo = Info.AllocasToInstrument[AI];
auto &DVIVec = AInfo.DbgVariableIntrinsics;
if (DVIVec.empty() || DVIVec.back() != DVI)
DVIVec.push_back(DVI);
}
};
for (Value *V : DVI->location_ops())
AddIfInteresting(V);
if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(DVI))
AddIfInteresting(DAI->getAddress());
}
}
Instruction *ExitUntag = getUntagLocationIfFunctionExit(Inst);
if (ExitUntag)
Expand Down
71 changes: 0 additions & 71 deletions llvm/test/CodeGen/AArch64/dbg-assign-tag-offset-mix-loc.ll

This file was deleted.

71 changes: 0 additions & 71 deletions llvm/test/CodeGen/AArch64/dbg-assign-tag-offset.ll

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
; RUN: opt %s -S -passes=declare-to-assign -o - | FileCheck %s

; CHECK: call void @llvm.dbg.assign
; CHECK: call void @llvm.dbg.declare

define dso_local void @f() sanitize_hwaddress !dbg !9 {
entry:
Expand Down

This file was deleted.