[llvm] [Transforms] Remove extraneous ArrayRef (NFC) (PR #89535)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 21 00:48:37 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
We don't need to create these instances of ArrayRef because
ConstantDataVector::get takes ArrayRef, and ArrayRef can be implicitly
constructed from C arrays.
---
Full diff: https://github.com/llvm/llvm-project/pull/89535.diff
2 Files Affected:
- (modified) llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp (+2-4)
- (modified) llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp (+2-4)
``````````diff
diff --git a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
index cdd891fc89483d..54b51b520369e5 100644
--- a/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
@@ -3201,8 +3201,7 @@ Value *DFSanVisitor::makeAddAcquireOrderingTable(IRBuilder<> &IRB) {
OrderingTable[(int)AtomicOrderingCABI::seq_cst] =
(int)AtomicOrderingCABI::seq_cst;
- return ConstantDataVector::get(IRB.getContext(),
- ArrayRef(OrderingTable, NumOrderings));
+ return ConstantDataVector::get(IRB.getContext(), OrderingTable);
}
void DFSanVisitor::visitLibAtomicLoad(CallBase &CB) {
@@ -3245,8 +3244,7 @@ Value *DFSanVisitor::makeAddReleaseOrderingTable(IRBuilder<> &IRB) {
OrderingTable[(int)AtomicOrderingCABI::seq_cst] =
(int)AtomicOrderingCABI::seq_cst;
- return ConstantDataVector::get(IRB.getContext(),
- ArrayRef(OrderingTable, NumOrderings));
+ return ConstantDataVector::get(IRB.getContext(), OrderingTable);
}
void DFSanVisitor::visitLibAtomicStore(CallBase &CB) {
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 1d7d0356ea6956..b1fd64fa3b293b 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -2131,8 +2131,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
OrderingTable[(int)AtomicOrderingCABI::seq_cst] =
(int)AtomicOrderingCABI::seq_cst;
- return ConstantDataVector::get(IRB.getContext(),
- ArrayRef(OrderingTable, NumOrderings));
+ return ConstantDataVector::get(IRB.getContext(), OrderingTable);
}
AtomicOrdering addAcquireOrdering(AtomicOrdering a) {
@@ -2166,8 +2165,7 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
OrderingTable[(int)AtomicOrderingCABI::seq_cst] =
(int)AtomicOrderingCABI::seq_cst;
- return ConstantDataVector::get(IRB.getContext(),
- ArrayRef(OrderingTable, NumOrderings));
+ return ConstantDataVector::get(IRB.getContext(), OrderingTable);
}
// ------------------- Visitors.
``````````
</details>
https://github.com/llvm/llvm-project/pull/89535
More information about the llvm-commits
mailing list