github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code.
:warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp --
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
--diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 54ee7b3e4..0caa9860b 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -1256,23 +1256,47 @@ struct MemorySanitizerVisitor : public
InstVisitor<MemorySanitizerVisitor> {
Value *getKmsanTLS(IRBuilderBase &IRB, int Index, const Twine &Name) {
Value *Ctx = IRB.CreateLoad(MS.PtrTy, ContextStateAlloca);
Constant *Zero = IRB.getInt32(0);
- return IRB.CreateGEP(MS.MsanContextStateTy, Ctx, {Zero,
IRB.getInt32(Index)}, Name);
+ return IRB.CreateGEP(MS.MsanContextStateTy, Ctx,
+ {Zero, IRB.getInt32(Index)}, Name);
}
- Value *getParamTLS(IRBuilderBase &IRB) { return IsRegionInstrumentedOnly ?
getKmsanTLS(IRB, 0, "param_shadow") : MS.ParamTLS; }
- Value *getRetvalTLS(IRBuilderBase &IRB) { return IsRegionInstrumentedOnly ?
getKmsanTLS(IRB, 1, "retval_shadow") : MS.RetvalTLS; }
- Value *getVAArgTLS(IRBuilderBase &IRB) { return IsRegionInstrumentedOnly ?
getKmsanTLS(IRB, 2, "va_arg_shadow") : MS.VAArgTLS; }
- Value *getVAArgOriginTLS(IRBuilderBase &IRB) { return
IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 3, "va_arg_origin") :
MS.VAArgOriginTLS; }
- Value *getVAArgOverflowSizeTLS(IRBuilderBase &IRB) { return
IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 4, "va_arg_overflow_size") :
MS.VAArgOverflowSizeTLS; }
- Value *getParamOriginTLS(IRBuilderBase &IRB) { return
IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 5, "param_origin") :
MS.ParamOriginTLS; }
- Value *getRetvalOriginTLS(IRBuilderBase &IRB) { return
IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 6, "retval_origin") :
MS.RetvalOriginTLS; }
+ Value *getParamTLS(IRBuilderBase &IRB) {
+ return IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 0, "param_shadow")
+ : MS.ParamTLS;
+ }
+ Value *getRetvalTLS(IRBuilderBase &IRB) {
+ return IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 1, "retval_shadow")
+ : MS.RetvalTLS;
+ }
+ Value *getVAArgTLS(IRBuilderBase &IRB) {
+ return IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 2, "va_arg_shadow")
+ : MS.VAArgTLS;
+ }
+ Value *getVAArgOriginTLS(IRBuilderBase &IRB) {
+ return IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 3, "va_arg_origin")
+ : MS.VAArgOriginTLS;
+ }
+ Value *getVAArgOverflowSizeTLS(IRBuilderBase &IRB) {
+ return IsRegionInstrumentedOnly
+ ? getKmsanTLS(IRB, 4, "va_arg_overflow_size")
+ : MS.VAArgOverflowSizeTLS;
+ }
+ Value *getParamOriginTLS(IRBuilderBase &IRB) {
+ return IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 5, "param_origin")
+ : MS.ParamOriginTLS;
+ }
+ Value *getRetvalOriginTLS(IRBuilderBase &IRB) {
+ return IsRegionInstrumentedOnly ? getKmsanTLS(IRB, 6, "retval_origin")
+ : MS.RetvalOriginTLS;
+ }
DenseMap<Instruction *, bool> InRegion;
MemorySanitizerVisitor(Function &F, MemorySanitizer &MS,
const TargetLibraryInfo &TLI)
: F(F), MS(MS), VAHelper(CreateVarArgHelper(F, MS, *this)), TLI(&TLI) {
- IsRegionInstrumentedOnly =
F.hasFnAttribute(Attribute::DisableSanitizerInstrumentation);
+ IsRegionInstrumentedOnly =
+ F.hasFnAttribute(Attribute::DisableSanitizerInstrumentation);
bool SanitizeFunction =
F.hasFnAttribute(Attribute::SanitizeMemory) && !ClDisableChecks;
@@ -1666,8 +1690,10 @@ struct MemorySanitizerVisitor : public
InstVisitor<MemorySanitizerVisitor> {
/// Add MemorySanitizer instrumentation to a function.
bool runOnFunction() {
if (IsRegionInstrumentedOnly) {
- IRBuilder<> AllocaIRB(&F.getEntryBlock(),
F.getEntryBlock().getFirstNonPHIIt());
- ContextStateAlloca = AllocaIRB.CreateAlloca(MS.PtrTy, nullptr,
"msan_context_state");
+ IRBuilder<> AllocaIRB(&F.getEntryBlock(),
+ F.getEntryBlock().getFirstNonPHIIt());
+ ContextStateAlloca =
+ AllocaIRB.CreateAlloca(MS.PtrTy, nullptr, "msan_context_state");
DenseMap<BasicBlock *, bool> BlockInRegionIn;
DenseMap<BasicBlock *, bool> BlockInRegionOut;
@@ -1679,9 +1705,11 @@ struct MemorySanitizerVisitor : public
InstVisitor<MemorySanitizerVisitor> {
bool State = BlockInRegionIn[&BB];
for (Instruction &I : BB) {
if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
- if (II->getIntrinsicID() ==
Intrinsic::kmsan_instrumentation_begin)
+ if (II->getIntrinsicID() ==
+ Intrinsic::kmsan_instrumentation_begin)
State = true;
- else if (II->getIntrinsicID() ==
Intrinsic::kmsan_instrumentation_end)
+ else if (II->getIntrinsicID() ==
+ Intrinsic::kmsan_instrumentation_end)
State = false;
}
InRegion[&I] = State;
@@ -7459,7 +7487,8 @@ struct MemorySanitizerVisitor : public
InstVisitor<MemorySanitizerVisitor> {
} else {
F.getContext().diagnose(DiagnosticInfoOptimizationFailure(
F, F.getSubprogram(),
- "llvm.kmsan.instrumentation intrinsics are ignored in fully
instrumented or no_sanitize(\"memory\") functions"));
+ "llvm.kmsan.instrumentation intrinsics are ignored in fully "
+ "instrumented or no_sanitize(\"memory\") functions"));
}
I.eraseFromParent();
return;
@@ -7468,7 +7497,8 @@ struct MemorySanitizerVisitor : public
InstVisitor<MemorySanitizerVisitor> {
if (!IsRegionInstrumentedOnly) {
F.getContext().diagnose(DiagnosticInfoOptimizationFailure(
F, F.getSubprogram(),
- "llvm.kmsan.instrumentation intrinsics are ignored in fully
instrumented or no_sanitize(\"memory\") functions"));
+ "llvm.kmsan.instrumentation intrinsics are ignored in fully "
+ "instrumented or no_sanitize(\"memory\") functions"));
}
I.eraseFromParent();
return;
@@ -7753,7 +7783,8 @@ struct MemorySanitizerVisitor : public
InstVisitor<MemorySanitizerVisitor> {
"_msret");
setShadow(&CB, RetvalShadow);
if (MS.TrackOrigins)
- setOrigin(&CB, IRBAfter.CreateLoad(MS.OriginTy,
getOriginPtrForRetval(IRB)));
+ setOrigin(&CB,
+ IRBAfter.CreateLoad(MS.OriginTy, getOriginPtrForRetval(IRB)));
}
bool isAMustTailRetVal(Value *RetVal) {
@@ -8201,8 +8232,9 @@ struct VarArgHelperBase : public VarArgHelper {
/// Compute the shadow address for a given va_arg.
Value *getShadowPtrForVAArgument(IRBuilder<> &IRB, unsigned ArgOffset) {
- return IRB.CreatePtrAdd(
- MSV.getVAArgTLS(IRB), ConstantInt::get(MS.IntptrTy, ArgOffset),
"_msarg_va_s");
+ return IRB.CreatePtrAdd(MSV.getVAArgTLS(IRB),
+ ConstantInt::get(MS.IntptrTy, ArgOffset),
+ "_msarg_va_s");
}
/// Compute the shadow address for a given va_arg.
@@ -8438,7 +8470,8 @@ struct VarArgAMD64Helper : public VarArgHelperBase {
VAArgTLSOriginCopy = IRB.CreateAlloca(Type::getInt8Ty(*MS.C),
CopySize);
VAArgTLSOriginCopy->setAlignment(kShadowTLSAlignment);
IRB.CreateMemCpy(VAArgTLSOriginCopy, kShadowTLSAlignment,
- MSV.getVAArgOriginTLS(IRB), kShadowTLSAlignment,
SrcSize);
+ MSV.getVAArgOriginTLS(IRB), kShadowTLSAlignment,
+ SrcSize);
}
}
@@ -8821,7 +8854,8 @@ struct VarArgPowerPC64Helper : public VarArgHelperBase {
assert(!VAArgSize && !VAArgTLSCopy &&
"finalizeInstrumentation called twice");
IRBuilder<> IRB(MSV.FnPrologueEnd);
- VAArgSize = IRB.CreateLoad(IRB.getInt64Ty(),
MSV.getVAArgOverflowSizeTLS(IRB));
+ VAArgSize =
+ IRB.CreateLoad(IRB.getInt64Ty(), MSV.getVAArgOverflowSizeTLS(IRB));
Value *CopySize = VAArgSize;
if (!VAStartInstrumentationList.empty()) {
@@ -9314,7 +9348,8 @@ struct VarArgSystemZHelper : public VarArgHelperBase {
VAArgTLSOriginCopy = IRB.CreateAlloca(Type::getInt8Ty(*MS.C),
CopySize);
VAArgTLSOriginCopy->setAlignment(kShadowTLSAlignment);
IRB.CreateMemCpy(VAArgTLSOriginCopy, kShadowTLSAlignment,
- MSV.getVAArgOriginTLS(IRB), kShadowTLSAlignment,
SrcSize);
+ MSV.getVAArgOriginTLS(IRB), kShadowTLSAlignment,
+ SrcSize);
}
}
@@ -9608,20 +9643,26 @@ bool MemorySanitizer::sanitizeFunction(Function &F,
TargetLibraryInfo &TLI) {
if (auto *II = dyn_cast<IntrinsicInst>(&I)) {
if (II->getIntrinsicID() == Intrinsic::kmsan_instrumentation_begin ||
II->getIntrinsicID() == Intrinsic::kmsan_instrumentation_end ||
- II->getIntrinsicID() ==
Intrinsic::kmsan_instrumentation_update_context) {
+ II->getIntrinsicID() ==
+ Intrinsic::kmsan_instrumentation_update_context) {
HasKmsanRegionIntrinsics = true;
break;
}
}
}
- bool IsFullyInstrumented = F.hasFnAttribute(Attribute::SanitizeMemory) &&
!ClDisableChecks;
- bool HasNoSanitizeMemory = !IsFullyInstrumented &&
!F.hasFnAttribute(Attribute::DisableSanitizerInstrumentation);
+ bool IsFullyInstrumented =
+ F.hasFnAttribute(Attribute::SanitizeMemory) && !ClDisableChecks;
+ bool HasNoSanitizeMemory =
+ !IsFullyInstrumented &&
+ !F.hasFnAttribute(Attribute::DisableSanitizerInstrumentation);
- if (HasKmsanRegionIntrinsics && (IsFullyInstrumented ||
HasNoSanitizeMemory)) {
+ if (HasKmsanRegionIntrinsics &&
+ (IsFullyInstrumented || HasNoSanitizeMemory)) {
F.getContext().diagnose(DiagnosticInfoOptimizationFailure(
F, F.getSubprogram(),
- "llvm.kmsan.instrumentation intrinsics are ignored in fully
instrumented or no_sanitize(\"memory\") functions"));
+ "llvm.kmsan.instrumentation intrinsics are ignored in fully "
+ "instrumented or no_sanitize(\"memory\") functions"));
}
if (F.hasFnAttribute(Attribute::DisableSanitizerInstrumentation)) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/202603
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits