[GVN, OptDiag] Include the value that is forwarded in load elimination
authorAdam Nemet <anemet@apple.com>
Mon, 28 Nov 2016 17:45:34 +0000 (17:45 +0000)
committerAdam Nemet <anemet@apple.com>
Mon, 28 Nov 2016 17:45:34 +0000 (17:45 +0000)
commita415a9bde6569ef9bd7f5f1053c802124a2e8d5e
treed87cf3b9b72bb6beaeb4be13b93356f696b48fd2
parente5112b14b9657a28c82dba921a6f57fa18559772
[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
llvm/include/llvm/Analysis/OptimizationDiagnosticInfo.h
llvm/include/llvm/IR/DiagnosticInfo.h
llvm/lib/IR/DiagnosticInfo.cpp
llvm/lib/Transforms/Scalar/GVN.cpp
llvm/test/Transforms/GVN/opt-remarks.ll