Skip to content

Commit

Permalink
Revert "Reapply [hwasan] Update dbg.assign intrinsics in HWAsan pass … (
Browse files Browse the repository at this point in the history
#79186)

…#78606"

This reverts commit 13c6f1e because it
causes an assertion in DebugInfoMetadata.cpp:1968 in Clang Linux
builders for Fuchsia.

https://logs.chromium.org/logs/fuchsia/buildbucket/cr-buildbucket/8758111613576762817/+/u/clang/build/stdout
  • Loading branch information
gulfemsavrun authored Jan 23, 2024
1 parent 32073b8 commit 7fe951a
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 @@ -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.

0 comments on commit 7fe951a

Please sign in to comment.