summaryrefslogtreecommitdiffstats
path: root/llvm/include
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-04-22 19:10:05 +0000
committerAdam Nemet <anemet@apple.com>2016-04-22 19:10:05 +0000
commitfe3def7c2a301ea414e0e7adf54e8216064268a0 (patch)
tree26be2ae07711201ca926a3a04740d66741070f57 /llvm/include
parent6493bc2b97e19ed5920b7d03cc677deb38658dac (diff)
downloadbcm5719-llvm-fe3def7c2a301ea414e0e7adf54e8216064268a0.tar.gz
bcm5719-llvm-fe3def7c2a301ea414e0e7adf54e8216064268a0.zip
[LoopUtils] Extend findStringMetadataForLoop to return the value for metadata
E.g. for: !1 = {"llvm.distribute", i32 1} it now returns the MDOperand for 1. I will use this in LoopDistribution to check the value of the metadata. Note that the change is backward-compatible with its current use in LoopVersioningLICM. An Optional implicitly converts to a bool depending whether it contains a value or not. llvm-svn: 267190
Diffstat (limited to 'llvm/include')
-rw-r--r--llvm/include/llvm/Transforms/Utils/LoopUtils.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/include/llvm/Transforms/Utils/LoopUtils.h b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
index cb789b80a93..ff0d673d16e 100644
--- a/llvm/include/llvm/Transforms/Utils/LoopUtils.h
+++ b/llvm/include/llvm/Transforms/Utils/LoopUtils.h
@@ -385,9 +385,13 @@ void computeLICMSafetyInfo(LICMSafetyInfo *, Loop *);
/// \brief Returns the instructions that use values defined in the loop.
SmallVector<Instruction *, 8> findDefsUsedOutsideOfLoop(Loop *L);
-/// \brief Find string metadata for loop, if it exists return true, else return
-/// false.
-bool findStringMetadataForLoop(Loop *TheLoop, StringRef Name);
+/// \brief Find string metadata for loop
+///
+/// If it has a value (e.g. {"llvm.distribute", 1} return the value as an
+/// operand or null otherwise. If the string metadata is not found return
+/// Optional's not-a-value.
+Optional<const MDOperand *> findStringMetadataForLoop(Loop *TheLoop,
+ StringRef Name);
/// \brief Set input string into loop metadata by keeping other values intact.
void addStringMetadataToLoop(Loop *TheLoop, const char *MDString,
OpenPOWER on IntegriCloud