[llvm-commits] [llvm] r37878 - in /llvm/trunk: lib/Transforms/Scalar/GVNPRE.cpp test/Transforms/GVNPRE/2007-07-04-SelectInst.ll
Owen Anderson
resistor at mac.com
Wed Jul 4 15:33:23 PDT 2007
Author: resistor
Date: Wed Jul 4 17:33:23 2007
New Revision: 37878
URL: http://llvm.org/viewvc/llvm-project?rev=37878&view=rev
Log:
Fix another bug, this time in PREing select instructions.
Added:
llvm/trunk/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll
Modified:
llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp?rev=37878&r1=37877&r2=37878&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/GVNPRE.cpp Wed Jul 4 17:33:23 2007
@@ -1586,8 +1586,7 @@
newVal = new ExtractElementInst(s1, s2, S->getName()+".gvnpre",
(*PI)->getTerminator());
else if (SelectInst* S = dyn_cast<SelectInst>(U))
- newVal = new SelectInst(S->getCondition(), S->getTrueValue(),
- S->getFalseValue(), S->getName()+".gvnpre",
+ newVal = new SelectInst(s1, s2, s3, S->getName()+".gvnpre",
(*PI)->getTerminator());
else if (CastInst* C = dyn_cast<CastInst>(U))
newVal = CastInst::create(C->getOpcode(), s1, C->getType(),
Added: llvm/trunk/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll?rev=37878&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll (added)
+++ llvm/trunk/test/Transforms/GVNPRE/2007-07-04-SelectInst.ll Wed Jul 4 17:33:23 2007
@@ -0,0 +1,18 @@
+; RUN: llvm-as < %s | opt -gvnpre | llvm-dis
+
+define void @set_depth_values(i32 %level) {
+cond_true90: ; preds = %cond_next84
+ br i1 false, label %cond_true105, label %cond_true151
+
+cond_true105: ; preds = %cond_true90
+ %tmp132 = add i32 %level, -3 ; <i32> [#uses=2]
+ %tmp133 = icmp sgt i32 %tmp132, 0 ; <i1> [#uses=1]
+ %max134 = select i1 %tmp133, i32 %tmp132, i32 1 ; <i32> [#uses=0]
+ br label %cond_true151
+
+cond_true151: ; preds = %cond_true140, %cond_true105
+ %tmp153 = add i32 %level, -3 ; <i32> [#uses=2]
+ %tmp154 = icmp sgt i32 %tmp153, 0 ; <i1> [#uses=1]
+ %max155 = select i1 %tmp154, i32 %tmp153, i32 1 ; <i32> [#uses=0]
+ ret void
+}
More information about the llvm-commits
mailing list