[llvm-branch-commits] [llvm-branch] r277382 - Merging r277114:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Aug 1 13:30:13 PDT 2016
Author: hans
Date: Mon Aug 1 15:30:12 2016
New Revision: 277382
URL: http://llvm.org/viewvc/llvm-project?rev=277382&view=rev
Log:
Merging r277114:
------------------------------------------------------------------------
r277114 | majnemer | 2016-07-28 22:39:21 -0700 (Thu, 28 Jul 2016) | 6 lines
[EarlyCSE] Correctly handle simplified, but live, instructions
Some instructions may have their uses replaced with a symbolic constant.
However, the instruction may still have side effects which percludes it
from being removed from the function. EarlyCSE treated such an
instruction as if it were removed, resulting in PR28763.
------------------------------------------------------------------------
Modified:
llvm/branches/release_39/ (props changed)
llvm/branches/release_39/lib/Transforms/Scalar/EarlyCSE.cpp
llvm/branches/release_39/test/Transforms/EarlyCSE/basic.ll
Propchange: llvm/branches/release_39/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Aug 1 15:30:12 2016
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276740,276956,276980,277135
+/llvm/trunk:155241,275868-275870,275879,275898,275928,275935,275946,275978,275981,276015,276077,276109,276119,276181,276209,276236-276237,276358,276364,276368,276389,276435,276438,276479,276510,276740,276956,276980,277114,277135
Modified: llvm/branches/release_39/lib/Transforms/Scalar/EarlyCSE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/lib/Transforms/Scalar/EarlyCSE.cpp?rev=277382&r1=277381&r2=277382&view=diff
==============================================================================
--- llvm/branches/release_39/lib/Transforms/Scalar/EarlyCSE.cpp (original)
+++ llvm/branches/release_39/lib/Transforms/Scalar/EarlyCSE.cpp Mon Aug 1 15:30:12 2016
@@ -582,6 +582,7 @@ bool EarlyCSE::processNode(DomTreeNode *
// its simpler value.
if (Value *V = SimplifyInstruction(Inst, DL, &TLI, &DT, &AC)) {
DEBUG(dbgs() << "EarlyCSE Simplify: " << *Inst << " to: " << *V << '\n');
+ bool Killed = false;
if (!Inst->use_empty()) {
Inst->replaceAllUsesWith(V);
Changed = true;
@@ -589,11 +590,12 @@ bool EarlyCSE::processNode(DomTreeNode *
if (isInstructionTriviallyDead(Inst, &TLI)) {
Inst->eraseFromParent();
Changed = true;
+ Killed = true;
}
- if (Changed) {
+ if (Changed)
++NumSimplify;
+ if (Killed)
continue;
- }
}
// If this is a simple instruction that we can value number, process it.
Modified: llvm/branches/release_39/test/Transforms/EarlyCSE/basic.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_39/test/Transforms/EarlyCSE/basic.ll?rev=277382&r1=277381&r2=277382&view=diff
==============================================================================
--- llvm/branches/release_39/test/Transforms/EarlyCSE/basic.ll (original)
+++ llvm/branches/release_39/test/Transforms/EarlyCSE/basic.ll Mon Aug 1 15:30:12 2016
@@ -276,3 +276,17 @@ define void @dse_neg2(i32 *%P) {
ret void
}
+ at c = external global i32, align 4
+declare i32 @reads_c(i32 returned)
+define void @pr28763() {
+entry:
+; CHECK-LABEL: @pr28763(
+; CHECK: store i32 0, i32* @c, align 4
+; CHECK: call i32 @reads_c(i32 0)
+; CHECK: store i32 2, i32* @c, align 4
+ %load = load i32, i32* @c, align 4
+ store i32 0, i32* @c, align 4
+ %call = call i32 @reads_c(i32 0)
+ store i32 2, i32* @c, align 4
+ ret void
+}
More information about the llvm-branch-commits
mailing list