Skip to content

Commit

Permalink
Revert "[hwasan] Update dbg.assign intrinsics in HWAsan pass" (#78971)
Browse files Browse the repository at this point in the history
  • Loading branch information
OCHyams committed Jan 22, 2024
1 parent b689b4f commit 5266c12
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 214 deletions.
4 changes: 4 additions & 0 deletions llvm/lib/IR/DebugInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2200,6 +2200,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)) {
assert(DAI->getAddress() == AI);
DAI->setAddressExpression(
DIExpression::prependOpcodes(DDI->getExpression(), 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.

0 comments on commit 5266c12

Please sign in to comment.