summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorVivek Pandya <vivekvpandya@gmail.com>2017-09-15 20:10:09 +0000
committerVivek Pandya <vivekvpandya@gmail.com>2017-09-15 20:10:09 +0000
commitb5ab895e2a62486d29e3bc564cc3f2edde3ff719 (patch)
treecdbf913ec72b8076539da7d2a592d930b68c153b /llvm/lib/Transforms
parent1dee3be51b77bb29bb7a5293b06f54f29d12d7d0 (diff)
downloadbcm5719-llvm-b5ab895e2a62486d29e3bc564cc3f2edde3ff719.tar.gz
bcm5719-llvm-b5ab895e2a62486d29e3bc564cc3f2edde3ff719.zip
This patch fixes https://bugs.llvm.org/show_bug.cgi?id=32352
It enables OptimizationRemarkEmitter::allowExtraAnalysis and MachineOptimizationRemarkEmitter::allowExtraAnalysis to return true not only for -fsave-optimization-record but when specific remarks are requested with command line options. The diagnostic handler used to be callback now this patch adds a class DiagnosticHandler. It has virtual method to provide custom diagnostic handler and methods to control which particular remarks are enabled. However LLVM-C API users can still provide callback function for diagnostic handler. llvm-svn: 313390
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp3
-rw-r--r--llvm/lib/Transforms/Vectorize/LoopVectorize.cpp21
2 files changed, 13 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 497e1d3eb37..593aad74bd1 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -920,8 +920,7 @@ bool GVN::AnalyzeLoadAvailability(LoadInst *LI, MemDepResult DepInfo,
Instruction *I = DepInfo.getInst();
dbgs() << " is clobbered by " << *I << '\n';
);
-
- if (ORE->allowExtraAnalysis())
+ if (ORE->allowExtraAnalysis(DEBUG_TYPE))
reportMayClobberedLoad(LI, DepInfo, DT, ORE);
return false;
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index a37c877db1e..d339143bf64 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -4957,12 +4957,15 @@ bool LoopVectorizationLegality::canVectorize() {
// Store the result and return it at the end instead of exiting early, in case
// allowExtraAnalysis is used to report multiple reasons for not vectorizing.
bool Result = true;
+
+ bool DoExtraAnalysis = ORE->allowExtraAnalysis(DEBUG_TYPE);
+ if (DoExtraAnalysis)
// We must have a loop in canonical form. Loops with indirectbr in them cannot
// be canonicalized.
if (!TheLoop->getLoopPreheader()) {
ORE->emit(createMissedAnalysis("CFGNotUnderstood")
<< "loop control flow is not understood by vectorizer");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -4975,7 +4978,7 @@ bool LoopVectorizationLegality::canVectorize() {
if (!TheLoop->empty()) {
ORE->emit(createMissedAnalysis("NotInnermostLoop")
<< "loop is not the innermost loop");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -4985,7 +4988,7 @@ bool LoopVectorizationLegality::canVectorize() {
if (TheLoop->getNumBackEdges() != 1) {
ORE->emit(createMissedAnalysis("CFGNotUnderstood")
<< "loop control flow is not understood by vectorizer");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -4995,7 +4998,7 @@ bool LoopVectorizationLegality::canVectorize() {
if (!TheLoop->getExitingBlock()) {
ORE->emit(createMissedAnalysis("CFGNotUnderstood")
<< "loop control flow is not understood by vectorizer");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -5007,7 +5010,7 @@ bool LoopVectorizationLegality::canVectorize() {
if (TheLoop->getExitingBlock() != TheLoop->getLoopLatch()) {
ORE->emit(createMissedAnalysis("CFGNotUnderstood")
<< "loop control flow is not understood by vectorizer");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -5021,7 +5024,7 @@ bool LoopVectorizationLegality::canVectorize() {
unsigned NumBlocks = TheLoop->getNumBlocks();
if (NumBlocks != 1 && !canVectorizeWithIfConvert()) {
DEBUG(dbgs() << "LV: Can't if-convert the loop.\n");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -5030,7 +5033,7 @@ bool LoopVectorizationLegality::canVectorize() {
// Check if we can vectorize the instructions and CFG in this loop.
if (!canVectorizeInstrs()) {
DEBUG(dbgs() << "LV: Can't vectorize the instructions or CFG\n");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -5039,7 +5042,7 @@ bool LoopVectorizationLegality::canVectorize() {
// Go over each instruction and look at memory deps.
if (!canVectorizeMemory()) {
DEBUG(dbgs() << "LV: Can't vectorize due to memory conflicts\n");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
@@ -5070,7 +5073,7 @@ bool LoopVectorizationLegality::canVectorize() {
<< "Too many SCEV assumptions need to be made and checked "
<< "at runtime");
DEBUG(dbgs() << "LV: Too many SCEV checks needed.\n");
- if (ORE->allowExtraAnalysis())
+ if (DoExtraAnalysis)
Result = false;
else
return false;
OpenPOWER on IntegriCloud