summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Utils
diff options
context:
space:
mode:
authorFlorian Hahn <florian.hahn@arm.com>2018-08-24 11:40:04 +0000
committerFlorian Hahn <florian.hahn@arm.com>2018-08-24 11:40:04 +0000
commit406f1ff1cdfe3ef065a3ac3414ff1672dcfb9049 (patch)
tree6ace68331402e73d75694236d0ced20b8cab2940 /llvm/lib/Transforms/Utils
parenta98961bc841fe930b80593af2342fa0c7d28d4f8 (diff)
downloadbcm5719-llvm-406f1ff1cdfe3ef065a3ac3414ff1672dcfb9049.tar.gz
bcm5719-llvm-406f1ff1cdfe3ef065a3ac3414ff1672dcfb9049.zip
[Local] Make DoesKMove required for combineMetadata.
This patch makes the DoesKMove argument non-optional, to force people to think about it. Most cases where it is false are either code hoisting or code sinking, where we pick one instruction from a set of equal instructions among different code paths. Reviewers: dberlin, nlopes, efriedma, davide Reviewed By: efriedma Differential Revision: https://reviews.llvm.org/D47475 llvm-svn: 340606
Diffstat (limited to 'llvm/lib/Transforms/Utils')
-rw-r--r--llvm/lib/Transforms/Utils/Local.cpp5
-rw-r--r--llvm/lib/Transforms/Utils/SimplifyCFG.cpp4
2 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index b8aa21be5c5..5ac66742c7c 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2354,7 +2354,8 @@ void llvm::combineMetadata(Instruction *K, const Instruction *J,
K->setMetadata(LLVMContext::MD_invariant_group, JMD);
}
-void llvm::combineMetadataForCSE(Instruction *K, const Instruction *J) {
+void llvm::combineMetadataForCSE(Instruction *K, const Instruction *J,
+ bool KDominatesJ) {
unsigned KnownIDs[] = {
LLVMContext::MD_tbaa, LLVMContext::MD_alias_scope,
LLVMContext::MD_noalias, LLVMContext::MD_range,
@@ -2362,7 +2363,7 @@ void llvm::combineMetadataForCSE(Instruction *K, const Instruction *J) {
LLVMContext::MD_invariant_group, LLVMContext::MD_align,
LLVMContext::MD_dereferenceable,
LLVMContext::MD_dereferenceable_or_null};
- combineMetadata(K, J, KnownIDs);
+ combineMetadata(K, J, KnownIDs, KDominatesJ);
}
void llvm::patchReplacementInstruction(Instruction *I, Value *Repl) {
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 4dbecf97794..28ed77adb18 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1316,7 +1316,7 @@ static bool HoistThenElseCodeToIf(BranchInst *BI,
LLVMContext::MD_dereferenceable,
LLVMContext::MD_dereferenceable_or_null,
LLVMContext::MD_mem_parallel_loop_access};
- combineMetadata(I1, I2, KnownIDs);
+ combineMetadata(I1, I2, KnownIDs, true);
// I1 and I2 are being combined into a single instruction. Its debug
// location is the merged locations of the original instructions.
@@ -1582,7 +1582,7 @@ static bool sinkLastInstruction(ArrayRef<BasicBlock*> Blocks) {
// However, as N-way merge for CallInst is rare, so we use simplified API
// instead of using complex API for N-way merge.
I0->applyMergedLocation(I0->getDebugLoc(), I->getDebugLoc());
- combineMetadataForCSE(I0, I);
+ combineMetadataForCSE(I0, I, true);
I0->andIRFlags(I);
}
OpenPOWER on IntegriCloud