[PATCH] D133065: [nfc][msan] Group checks per instruction
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 1 13:10:40 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG911067306253: [nfc][msan] Group checks per instruction (authored by vitalybuka).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133065/new/
https://reviews.llvm.org/D133065
Files:
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1274,8 +1274,10 @@
bool InstrumentWithCalls,
ArrayRef<ShadowOriginAndInsertPoint> InstructionChecks) {
const DataLayout &DL = F.getParent()->getDataLayout();
+ Instruction *Instruction = InstructionChecks.front().OrigIns;
for (const auto &ShadowData : InstructionChecks) {
- IRBuilder<> IRB(ShadowData.OrigIns);
+ assert(ShadowData.OrigIns == Instruction);
+ IRBuilder<> IRB(Instruction);
LLVM_DEBUG(dbgs() << " SHAD0 : " << *ShadowData.Shadow << "\n");
Value *ConvertedShadow = convertShadowToScalar(ShadowData.Shadow, IRB);
@@ -1300,7 +1302,25 @@
}
void materializeChecks(bool InstrumentWithCalls) {
- materializeInstructionChecks(InstrumentWithCalls, InstrumentationList);
+ llvm::stable_sort(InstrumentationList,
+ [](const ShadowOriginAndInsertPoint &L,
+ const ShadowOriginAndInsertPoint &R) {
+ return L.OrigIns < R.OrigIns;
+ });
+
+ for (auto I = InstrumentationList.begin();
+ I != InstrumentationList.end();) {
+ auto J =
+ std::find_if(I + 1, InstrumentationList.end(),
+ [L = I->OrigIns](const ShadowOriginAndInsertPoint &R) {
+ return L != R.OrigIns;
+ });
+ // Process all checks of instruction at once.
+ materializeInstructionChecks(InstrumentWithCalls,
+ ArrayRef<ShadowOriginAndInsertPoint>(I, J));
+ I = J;
+ }
+
LLVM_DEBUG(dbgs() << "DONE:\n" << F);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133065.457371.patch
Type: text/x-patch
Size: 1845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220901/bda8f890/attachment.bin>
More information about the llvm-commits
mailing list