summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorAdam Nemet <anemet@apple.com>2016-11-28 17:45:34 +0000
committerAdam Nemet <anemet@apple.com>2016-11-28 17:45:34 +0000
commita415a9bde6569ef9bd7f5f1053c802124a2e8d5e (patch)
treed87cf3b9b72bb6beaeb4be13b93356f696b48fd2 /llvm/lib/Transforms/Scalar
parente5112b14b9657a28c82dba921a6f57fa18559772 (diff)
downloadbcm5719-llvm-a415a9bde6569ef9bd7f5f1053c802124a2e8d5e.tar.gz
bcm5719-llvm-a415a9bde6569ef9bd7f5f1053c802124a2e8d5e.zip
[GVN, OptDiag] Include the value that is forwarded in load elimination
This requires some changes to the opt-diag API. Hal and I have discussed this at the Dev Meeting and came up with a streaming delimiter (setExtraArgs) to solve this. Arguments after this delimiter are only included in the optimization records and not in the remarks printed in the compiler output. (Note, how in the test the content of the YAML file changes but the remarks on the compiler output don't.) This implements the green GVN message with a bug fix at line http://lab.llvm.org:8080/artifacts/opt-view_test-suite/build/SingleSource/Benchmarks/Dhrystone/CMakeFiles/dry.dir/html/_org_test-suite_SingleSource_Benchmarks_Dhrystone_dry.c.html#L446 The fix is that now we properly include the constant value in the message: "load of type i32 eliminated in favor of 7" Differential Revision: https://reviews.llvm.org/D26489 llvm-svn: 288047
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 83a7efe14e9..4f66c5d1314 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1590,10 +1590,13 @@ bool GVN::PerformLoadPRE(LoadInst *LI, AvailValInBlkVect &ValuesPerBlock,
return true;
}
-static void reportLoadElim(LoadInst *LI, OptimizationRemarkEmitter *ORE) {
+static void reportLoadElim(LoadInst *LI, Value *AvailableValue,
+ OptimizationRemarkEmitter *ORE) {
+ using namespace ore;
ORE->emit(OptimizationRemark(DEBUG_TYPE, "LoadElim", LI)
- << "load of type " << ore::NV("Type", LI->getType())
- << " eliminated");
+ << "load of type " << NV("Type", LI->getType()) << " eliminated"
+ << setExtraArgs() << " in favor of "
+ << NV("InfavorOfValue", AvailableValue));
}
/// Attempt to eliminate a load whose dependencies are
@@ -1666,7 +1669,7 @@ bool GVN::processNonLocalLoad(LoadInst *LI) {
MD->invalidateCachedPointerInfo(V);
markInstructionForDeletion(LI);
++NumGVNLoad;
- reportLoadElim(LI, ORE);
+ reportLoadElim(LI, V, ORE);
return true;
}
@@ -1813,7 +1816,7 @@ bool GVN::processLoad(LoadInst *L) {
patchAndReplaceAllUsesWith(L, AvailableValue);
markInstructionForDeletion(L);
++NumGVNLoad;
- reportLoadElim(L, ORE);
+ reportLoadElim(L, AvailableValue, ORE);
// Tell MDA to rexamine the reused pointer since we might have more
// information after forwarding it.
if (MD && AvailableValue->getType()->getScalarType()->isPointerTy())
OpenPOWER on IntegriCloud