[llvm] [NFCI][msan] Refactor into 'horizontalReduce' (PR #152961)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 11 00:12:27 PDT 2025
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 HEAD~1 HEAD --extensions cpp -- llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
``````````
</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 5e618fec6..572edf32b 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2690,13 +2690,14 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
SC.Done(&I);
}
- // Perform a bitwise OR on the horizontal pairs (or other specified grouping)
+ // Perform a bitwise OR on the horizontal pairs (or other specified grouping)
// of elements. This is convenient for instrumenting horizontal add/sub.
Value *horizontalReduce(IntrinsicInst &I, unsigned ReductionFactor,
- Value *VectorA, Value* VectorB) {
+ Value *VectorA, Value *VectorB) {
IRBuilder<> IRB(&I);
assert(isa<FixedVectorType>(VectorA->getType()));
- unsigned TotalNumElems = cast<FixedVectorType>(VectorA->getType())->getNumElements();
+ unsigned TotalNumElems =
+ cast<FixedVectorType>(VectorA->getType())->getNumElements();
if (VectorB) {
assert(VectorA->getType() == VectorB->getType());
@@ -2753,8 +2754,8 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
if (I.arg_size() == 2)
SecondArgShadow = getShadow(&I, 1);
- Value *OrShadow = horizontalReduce(I, /*ReductionFactor=*/ 2,
- FirstArgShadow, SecondArgShadow);
+ Value *OrShadow = horizontalReduce(I, /*ReductionFactor=*/2, FirstArgShadow,
+ SecondArgShadow);
OrShadow = CreateShadowCast(IRB, OrShadow, getShadowTy(&I));
@@ -2810,12 +2811,11 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
Value *SecondArgShadow = nullptr;
if (I.arg_size() == 2) {
SecondArgShadow = getShadow(&I, 1);
- SecondArgShadow = IRB.CreateBitCast(SecondArgShadow,
- ReinterpretShadowTy);
+ SecondArgShadow = IRB.CreateBitCast(SecondArgShadow, ReinterpretShadowTy);
}
- Value *OrShadow = horizontalReduce(I, /*ReductionFactor=*/ 2,
- FirstArgShadow, SecondArgShadow);
+ Value *OrShadow = horizontalReduce(I, /*ReductionFactor=*/2, FirstArgShadow,
+ SecondArgShadow);
OrShadow = CreateShadowCast(IRB, OrShadow, getShadowTy(&I));
``````````
</details>
https://github.com/llvm/llvm-project/pull/152961
More information about the llvm-commits
mailing list