aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/VectorUtils.cpp
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@quicinc.com>2021-05-07 12:52:20 -0500
committerKrzysztof Parzyszek <kparzysz@quicinc.com>2021-05-07 13:20:50 -0500
commit50cf0a1d1ae48bd0397b41a400e01c62975b6706 (patch)
tree8e8e24b4052bded863e7bbab7e5138833c857b24 /llvm/lib/Analysis/VectorUtils.cpp
parentd8aba75a768033c326613d85e8789703cb4565d2 (diff)
downloadllvm-50cf0a1d1ae48bd0397b41a400e01c62975b6706.zip
llvm-50cf0a1d1ae48bd0397b41a400e01c62975b6706.tar.gz
llvm-50cf0a1d1ae48bd0397b41a400e01c62975b6706.tar.bz2
Allow empty value list in propagateMetadata(Inst, ArrayOf...)
This will allow writing propagateMetadata(Inst, collectInterestingValues(...)) without concern about empty lists. In case of an empty list, Inst is returned without any changes.
Diffstat (limited to 'llvm/lib/Analysis/VectorUtils.cpp')
-rw-r--r--llvm/lib/Analysis/VectorUtils.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/VectorUtils.cpp b/llvm/lib/Analysis/VectorUtils.cpp
index aeec439..f7c3929 100644
--- a/llvm/lib/Analysis/VectorUtils.cpp
+++ b/llvm/lib/Analysis/VectorUtils.cpp
@@ -708,6 +708,8 @@ MDNode *llvm::intersectAccessGroups(const Instruction *Inst1,
/// \returns \p I after propagating metadata from \p VL.
Instruction *llvm::propagateMetadata(Instruction *Inst, ArrayRef<Value *> VL) {
+ if (VL.empty())
+ return Inst;
Instruction *I0 = cast<Instruction>(VL[0]);
SmallVector<std::pair<unsigned, MDNode *>, 4> Metadata;
I0->getAllMetadataOtherThanDebugLoc(Metadata);