summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>2016-10-12 13:44:24 +0000
committerKonstantin Zhuravlyov <kzhuravl_dev@outlook.com>2016-10-12 13:44:24 +0000
commit081385a74e2798f2aec7863cd2afcad343a52a48 (patch)
treeb7de8a7799ca09aee3fc73c89e9b79681c24d4a4 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parentc215c3fd143d11f6fd051b5556b04970f9888381 (diff)
downloadbcm5719-llvm-081385a74e2798f2aec7863cd2afcad343a52a48.tar.gz
bcm5719-llvm-081385a74e2798f2aec7863cd2afcad343a52a48.zip
[DAGCombiner] Do not remove the load of stored values when optimizations are disabled
This combiner breaks debug experience and should not be run when optimizations are disabled. For example: int main() { int j = 0; j += 2; if (j == 2) return 0; return 5; } When debugging this code compiled in /O0, it should be valid to break at line "j+=2;" and edit the value of j. It should change the return value of the function. Differential Revision: https://reviews.llvm.org/D19268 llvm-svn: 284014
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 57cee4706d8..5d5ba3f6d5e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -10196,7 +10196,8 @@ SDValue DAGCombiner::visitLOAD(SDNode *N) {
// value.
// TODO: Handle store large -> read small portion.
// TODO: Handle TRUNCSTORE/LOADEXT
- if (ISD::isNormalLoad(N) && !LD->isVolatile()) {
+ if (OptLevel != CodeGenOpt::None &&
+ ISD::isNormalLoad(N) && !LD->isVolatile()) {
if (ISD::isNON_TRUNCStore(Chain.getNode())) {
StoreSDNode *PrevST = cast<StoreSDNode>(Chain);
if (PrevST->getBasePtr() == Ptr &&
OpenPOWER on IntegriCloud