[llvm-commits] [llvm] r152595 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/EarlyCSE/instsimplify-dom.ll
Eli Friedman
eli.friedman at gmail.com
Mon Mar 12 18:06:07 PDT 2012
Author: efriedma
Date: Mon Mar 12 20:06:07 2012
New Revision: 152595
URL: http://llvm.org/viewvc/llvm-project?rev=152595&view=rev
Log:
Fix regression from r151466: an we can't replace uses of an instruction reachable from the entry block with uses of an instruction not reachable from the entry block. PR12231.
Added:
llvm/trunk/test/Transforms/EarlyCSE/instsimplify-dom.ll
Modified:
llvm/trunk/lib/Analysis/InstructionSimplify.cpp
Modified: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstructionSimplify.cpp?rev=152595&r1=152594&r2=152595&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp Mon Mar 12 20:06:07 2012
@@ -94,9 +94,13 @@
return true;
// If we have a DominatorTree then do a precise test.
- if (DT)
- return !DT->isReachableFromEntry(P->getParent()) ||
- !DT->isReachableFromEntry(I->getParent()) || DT->dominates(I, P);
+ if (DT) {
+ if (!DT->isReachableFromEntry(P->getParent()))
+ return true;
+ if (!DT->isReachableFromEntry(I->getParent()))
+ return false;
+ return DT->dominates(I, P);
+ }
// Otherwise, if the instruction is in the entry block, and is not an invoke,
// then it obviously dominates all phi nodes.
Added: llvm/trunk/test/Transforms/EarlyCSE/instsimplify-dom.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/EarlyCSE/instsimplify-dom.ll?rev=152595&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/EarlyCSE/instsimplify-dom.ll (added)
+++ llvm/trunk/test/Transforms/EarlyCSE/instsimplify-dom.ll Mon Mar 12 20:06:07 2012
@@ -0,0 +1,19 @@
+; RUN: opt -early-cse -S < %s | FileCheck %s
+; PR12231
+
+declare i32 @f()
+
+define i32 @fn() {
+entry:
+ br label %lbl_1215
+
+lbl_1215:
+ %ins34 = phi i32 [ %ins35, %xxx ], [ undef, %entry ]
+ ret i32 %ins34
+
+xxx:
+ %ins35 = call i32 @f()
+ br label %lbl_1215
+}
+
+; CHECK: define i32 @fn
More information about the llvm-commits
mailing list