This is an archive of the discontinued LLVM Phabricator instance.

[HWASAN] use common alignAndPadAlloca
ClosedPublic

Authored by fmayer on Feb 11 2022, 7:24 PM.

Diff Detail

Event Timeline

fmayer created this revision.Feb 11 2022, 7:24 PM
fmayer requested review of this revision.Feb 11 2022, 7:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 11 2022, 7:25 PM

I am also looking whether this code in Aarch64StackTagging needs changing or whether there are different constraints (because HWASAN does more changes to debug intrinsics)

// Fixup debug intrinsics to point to the new alloca.
for (auto DVI : Info.DbgVariableIntrinsics)
  DVI->replaceVariableLocationOp(Info.OldAI, Info.AI)

If we only use this code for HWASAN, IR regression tests (alloca.ll and dbg-value-tag-offset.ll) fail.

fmayer planned changes to this revision.Feb 11 2022, 8:05 PM

I am also looking whether this code in Aarch64StackTagging needs changing or whether there are different constraints (because HWASAN does more changes to debug intrinsics)

// Fixup debug intrinsics to point to the new alloca.
for (auto DVI : Info.DbgVariableIntrinsics)
  DVI->replaceVariableLocationOp(Info.OldAI, Info.AI)

If we only use this code for HWASAN, IR regression tests (alloca.ll and dbg-value-tag-offset.ll) fail.

Actually, I need to look more at this now.

eugenis added inline comments.Feb 14 2022, 2:46 PM
llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
1382

Why don't we do the same in AArch64StackTagging?

fmayer updated this revision to Diff 408631.Feb 14 2022, 2:48 PM

don't change too much at once.

I am also looking whether this code in Aarch64StackTagging needs changing or whether there are different constraints (because HWASAN does more changes to debug intrinsics)

// Fixup debug intrinsics to point to the new alloca.
for (auto DVI : Info.DbgVariableIntrinsics)
  DVI->replaceVariableLocationOp(Info.OldAI, Info.AI)

If we only use this code for HWASAN, IR regression tests (alloca.ll and dbg-value-tag-offset.ll) fail.

Actually, I need to look more at this now.

I've looked into this. I think it makes sense to allow replacing multiple

llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
1382

I am looking into that separately. I also reverted this code to the one we had in HWASan, so we don't do too many changes in one go.

eugenis accepted this revision.Feb 14 2022, 2:57 PM

LGTM

This revision is now accepted and ready to land.Feb 14 2022, 2:57 PM
This revision was landed with ongoing or failed builds.Feb 14 2022, 3:28 PM
This revision was automatically updated to reflect the committed changes.