[llvm-commits] [llvm] r45384 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

2007-12-28 Thread Owen Anderson
Author: resistor
Date: Fri Dec 28 01:42:12 2007
New Revision: 45384

URL: http://llvm.org/viewvc/llvm-project?rev=45384&view=rev
Log:
Repair a transform that Chris noticed a bug in.  Thanks to Nicholas for 
pointing out my stupid mistakes when writing this patch. :-)

Modified:
llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=45384&r1=45383&r2=45384&view=diff

==
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri Dec 28 
01:42:12 2007
@@ -4835,11 +4835,18 @@
   if (ConstantInt *CI = dyn_cast(Op1)) {
   Value *A, *B;
 
-#if 0
-// (icmp cond (sub A B) 0) -> (icmp cond A B)
-if (CI->isNullValue() && match(Op0, m_Sub(m_Value(A), m_Value(B
-  return new ICmpInst(I.getPredicate(), A, B);
-#endif
+// (icmp cond (sub A B) 0) -> ...
+if (CI->isNullValue() && match(Op0, m_Sub(m_Value(A), m_Value(B {
+  // (icmp cond A B) if cond is signed or equality
+  if (CmpInst::isSigned(I.getPredicate()) || I.isEquality())
+return new ICmpInst(I.getPredicate(), A, B);
+  // (icmp ne A B) if cond is ugt
+  else if (I.getPredicate() == ICmpInst::ICMP_UGT)
+return new ICmpInst(ICmpInst::ICMP_NE, A, B);
+  // (icmp eq A B) if cond is ule
+  else if (I.getPredicate() == ICmpInst::ICMP_ULE)
+return new ICmpInst(ICmpInst::ICMP_EQ, A, B);
+}
 
 switch (I.getPredicate()) {
 default: break;


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r45384 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

2007-12-28 Thread Chris Lattner
On Dec 27, 2007, at 11:42 PM, Owen Anderson wrote:
> URL: http://llvm.org/viewvc/llvm-project?rev=45384&view=rev
> Log:
> Repair a transform that Chris noticed a bug in.  Thanks to Nicholas  
> for pointing out my stupid mistakes when writing this patch. :-)

Thanks Owen!  A minor tweak:

> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ==
> --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp  
> (original)
> +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri  
> Dec 28 01:42:12 2007
> @@ -4835,11 +4835,18 @@
>   if (ConstantInt *CI = dyn_cast(Op1)) {
>   Value *A, *B;
>
> +// (icmp cond (sub A B) 0) -> ...
> +if (CI->isNullValue() && match(Op0, m_Sub(m_Value(A),  
> m_Value(B {
> +  // (icmp cond A B) if cond is signed or equality
> +  if (CmpInst::isSigned(I.getPredicate()) || I.isEquality())
> +return new ICmpInst(I.getPredicate(), A, B);
> +  // (icmp ne A B) if cond is ugt
> +  else if (I.getPredicate() == ICmpInst::ICMP_UGT)
> +return new ICmpInst(ICmpInst::ICMP_NE, A, B);
> +  // (icmp eq A B) if cond is ule
> +  else if (I.getPredicate() == ICmpInst::ICMP_ULE)
> +return new ICmpInst(ICmpInst::ICMP_EQ, A, B);
> +}

Why not handle UGE and ULT?  If it is handled elsewhere, please add a  
comment to that effect, thanks!

-Chris
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm-gcc-4.2] r45385 - in /llvm-gcc-4.2/trunk: configure configure.in

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Fri Dec 28 13:18:11 2007
New Revision: 45385

URL: http://llvm.org/viewvc/llvm-project?rev=45385&view=rev
Log:
when gfortran is enabled, built libgfortran, even for 
darwin targets.

Modified:
llvm-gcc-4.2/trunk/configure
llvm-gcc-4.2/trunk/configure.in

Modified: llvm-gcc-4.2/trunk/configure
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure?rev=45385&r1=45384&r2=45385&view=diff

==
--- llvm-gcc-4.2/trunk/configure (original)
+++ llvm-gcc-4.2/trunk/configure Fri Dec 28 13:18:11 2007
@@ -1214,7 +1214,7 @@
 noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libssp"
 # LLVM LOCAL begin
 noconfigdirs="$noconfigdirs target-boehm-gc target-libffi"
-noconfigdirs="$noconfigdirs target-libgfortran target-libjava"
+noconfigdirs="$noconfigdirs target-libjava"
 noconfigdirs="$noconfigdirs target-libmudflap target-zlib"
 # LLVM LOCAL end
 ;;
@@ -1224,7 +1224,7 @@
 noconfigdirs="$noconfigdirs sim target-rda"
 # LLVM LOCAL begin
 noconfigdirs="$noconfigdirs target-boehm-gc target-libffi"
-noconfigdirs="$noconfigdirs target-libgfortran target-libjava"
+noconfigdirs="$noconfigdirs target-libjava"
 noconfigdirs="$noconfigdirs target-libmudflap target-libobjc"
 noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-zlib"
 # LLVM LOCAL end
@@ -1235,7 +1235,7 @@
 noconfigdirs="$noconfigdirs ${libgcj}"
 # LLVM LOCAL begin
 noconfigdirs="$noconfigdirs target-boehm-gc target-libffi"
-noconfigdirs="$noconfigdirs target-libgfortran target-libjava"
+noconfigdirs="$noconfigdirs target-libjava"
 noconfigdirs="$noconfigdirs target-libmudflap target-libobjc"
 noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-zlib"
 # LLVM LOCAL end

Modified: llvm-gcc-4.2/trunk/configure.in
URL: 
http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/configure.in?rev=45385&r1=45384&r2=45385&view=diff

==
--- llvm-gcc-4.2/trunk/configure.in (original)
+++ llvm-gcc-4.2/trunk/configure.in Fri Dec 28 13:18:11 2007
@@ -374,7 +374,7 @@
 noconfigdirs="$noconfigdirs target-libstdc++-v3 target-libssp"
 # LLVM LOCAL begin
 noconfigdirs="$noconfigdirs target-boehm-gc target-libffi"
-noconfigdirs="$noconfigdirs target-libgfortran target-libjava"
+noconfigdirs="$noconfigdirs target-libjava"
 noconfigdirs="$noconfigdirs target-libmudflap target-zlib"
 # LLVM LOCAL end
 ;;
@@ -384,7 +384,7 @@
 noconfigdirs="$noconfigdirs sim target-rda"
 # LLVM LOCAL begin
 noconfigdirs="$noconfigdirs target-boehm-gc target-libffi"
-noconfigdirs="$noconfigdirs target-libgfortran target-libjava"
+noconfigdirs="$noconfigdirs target-libjava"
 noconfigdirs="$noconfigdirs target-libmudflap target-libobjc"
 noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-zlib"
 # LLVM LOCAL end
@@ -395,7 +395,7 @@
 noconfigdirs="$noconfigdirs ${libgcj}"
 # LLVM LOCAL begin
 noconfigdirs="$noconfigdirs target-boehm-gc target-libffi"
-noconfigdirs="$noconfigdirs target-libgfortran target-libjava"
+noconfigdirs="$noconfigdirs target-libjava"
 noconfigdirs="$noconfigdirs target-libmudflap target-libobjc"
 noconfigdirs="$noconfigdirs target-libssp target-libstdc++-v3 target-zlib"
 # LLVM LOCAL end


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45386 - /llvm/trunk/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll

2007-12-28 Thread Owen Anderson
Author: resistor
Date: Fri Dec 28 15:08:43 2007
New Revision: 45386

URL: http://llvm.org/viewvc/llvm-project?rev=45386&view=rev
Log:
Add a testcase for my recent InstCombine fix, written by Nicholas.

Added:
llvm/trunk/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll

Added: llvm/trunk/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll?rev=45386&view=auto

==
--- llvm/trunk/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll (added)
+++ llvm/trunk/test/Transforms/InstCombine/2007-12-28-IcmpSub2.ll Fri Dec 28 
15:08:43 2007
@@ -0,0 +1,89 @@
+; RUN: llvm-as < %s | opt -mem2reg -instcombine | llvm-dis | grep "ret i32 1" 
| count 8
+
+define i32 @test1() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp ule i32 %sub, 0
+   %retval = select i1 %cmp, i32 0, i32 1
+   ret i32 %retval
+}
+
+define i32 @test2() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp ugt i32 %sub, 0
+   %retval = select i1 %cmp, i32 1, i32 0
+   ret i32 %retval
+}
+
+define i32 @test3() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp slt i32 %sub, 0
+   %retval = select i1 %cmp, i32 1, i32 0
+   ret i32 %retval
+}
+
+define i32 @test4() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp sle i32 %sub, 0
+   %retval = select i1 %cmp, i32 1, i32 0
+   ret i32 %retval
+}
+
+define i32 @test5() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp sge i32 %sub, 0
+   %retval = select i1 %cmp, i32 0, i32 1
+   ret i32 %retval
+}
+
+define i32 @test6() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp sgt i32 %sub, 0
+   %retval = select i1 %cmp, i32 0, i32 1
+   ret i32 %retval
+}
+
+define i32 @test7() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp eq i32 %sub, 0
+   %retval = select i1 %cmp, i32 0, i32 1
+   ret i32 %retval
+}
+
+define i32 @test8() {
+entry:
+   %z = alloca i32
+   store i32 0, i32* %z
+   %tmp = load i32* %z
+   %sub = sub i32 %tmp, 1
+   %cmp = icmp ne i32 %sub, 0
+   %retval = select i1 %cmp, i32 1, i32 0
+   ret i32 %retval
+}
\ No newline at end of file


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45387 - /llvm/trunk/lib/Target/X86/README.txt

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Fri Dec 28 15:50:40 2007
New Revision: 45387

URL: http://llvm.org/viewvc/llvm-project?rev=45387&view=rev
Log:
add a note.

Modified:
llvm/trunk/lib/Target/X86/README.txt

Modified: llvm/trunk/lib/Target/X86/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=45387&r1=45386&r2=45387&view=diff

==
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Fri Dec 28 15:50:40 2007
@@ -1585,3 +1585,35 @@
 if the flags of the xor are dead.
 
 //===-===//
+
+This testcase misses a read/modify/write opportunity (from PR1425):
+
+void vertical_decompose97iH1(int *b0, int *b1, int *b2, int width){
+int i;
+for(i=0; i>0;
+}
+
+We compile it down to:
+
+LBB1_2:# bb
+   movl(%esi,%edi,4), %ebx
+   addl(%ecx,%edi,4), %ebx
+   addl(%edx,%edi,4), %ebx
+   movl%ebx, (%ecx,%edi,4)
+   incl%edi
+   cmpl%eax, %edi
+   jne LBB1_2  # bb
+
+the inner loop should add to the memory location (%ecx,%edi,4), saving
+a mov.  Something like:
+
+movl(%esi,%edi,4), %ebx
+addl(%edx,%edi,4), %ebx
+addl%ebx, (%ecx,%edi,4)
+
+Additionally, LSR should rewrite the exit condition of the loop to use
+a stride-4 IV, would would allow all the scales in the loop to go away.
+This would result in smaller code and more efficient microops.
+
+//===-===//


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45388 - /llvm/trunk/lib/Target/README.txt

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Fri Dec 28 16:30:05 2007
New Revision: 45388

URL: http://llvm.org/viewvc/llvm-project?rev=45388&view=rev
Log:
add a note.

Modified:
llvm/trunk/lib/Target/README.txt

Modified: llvm/trunk/lib/Target/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=45388&r1=45387&r2=45388&view=diff

==
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Fri Dec 28 16:30:05 2007
@@ -480,6 +480,38 @@
   }
 }
 
+//===-===//
+
+We should investigate an instruction sinking pass.  Consider this silly
+example in pic mode:
+
+#include 
+void foo(int x) {
+  assert(x);
+  //...
+}
+
+we compile this to:
+_foo:
+   subl$28, %esp
+   call"L1$pb"
+"L1$pb":
+   popl%eax
+   cmpl$0, 32(%esp)
+   je  LBB1_2  # cond_true
+LBB1_1:# return
+   # ...
+   addl$28, %esp
+   ret
+LBB1_2:# cond_true
+...
+
+The PIC base computation (call+popl) is only used on one path through the 
+code, but is currently always computed in the entry block.  It would be 
+better to sink the picbase computation down into the block for the 
+assertion, as it is the only one that uses it.  This happens for a lot of 
+code with early outs.
 
+In this case, whole-function-isel would also handle this.
 
 //===-===//


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45389 - /llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll

2007-12-28 Thread Devang Patel
Author: dpatel
Date: Fri Dec 28 16:59:48 2007
New Revision: 45389

URL: http://llvm.org/viewvc/llvm-project?rev=45389&view=rev
Log:

Test -simplifycfg only.

Modified:
llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll

Modified: llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll?rev=45389&r1=45388&r2=45389&view=diff

==
--- llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll (original)
+++ llvm/trunk/test/Transforms/SimplifyCFG/2007-12-21-Crash.ll Fri Dec 28 
16:59:48 2007
@@ -1,58 +1,35 @@
-; RUN:  llvm-as < %s | opt -std-compile-opts -disable-output
-
+;RUN: llvm-as < %s | opt -simplifycfg -disable-output
 target datalayout = 
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
 
-define i32 @bork() {
+define i32 @bork() nounwind  {
 entry:
-   %retval = alloca i32;  [#uses=2]
-   %opt = alloca i32   ;  [#uses=3]
-   %undo = alloca i32  ;  [#uses=3]
-   %tmp = alloca i32   ;  [#uses=3]
-   %"alloca point" = bitcast i32 0 to i32  ;  [#uses=0]
-   store i32 0, i32* %undo, align 4
-   br label %bb5
-
-bb:; preds = %bb5
-   %tmp1 = load i32* %opt, align 4 ;  [#uses=1]
-   switch i32 %tmp1, label %bb4 [
-i32 102, label %bb3
-i32 110, label %bb2
-   ]
+   br label %bb5.outer
 
-bb2:   ; preds = %bb
-   store i32 1, i32* %undo, align 4
-   br label %bb3
+bb5.outer.loopexit:; preds = %bb5
+   br label %bb5.outer
 
-bb3:   ; preds = %bb2, %bb
+bb5.outer: ; preds = %bb5.outer.loopexit, %entry
+   %undo.0.ph = phi i32 [ 0, %entry ], [ 1, %bb5.outer.loopexit ]  
;  [#uses=1]
br label %bb5
 
-bb4:   ; preds = %bb
-   store i32 258, i32* %tmp, align 4
-   br label %bb13
-
-bb5:   ; preds = %bb3, %entry
-   %tmp6 = call i32 (...)* @foo( ) nounwind;  
[#uses=1]
-   store i32 %tmp6, i32* %opt, align 4
-   %tmp7 = load i32* %opt, align 4 ;  [#uses=1]
-   %tmp8 = icmp ne i32 %tmp7, -1   ;  [#uses=1]
-   %tmp89 = zext i1 %tmp8 to i8;  [#uses=1]
-   %toBool = icmp ne i8 %tmp89, 0  ;  [#uses=1]
-   br i1 %toBool, label %bb, label %bb10
+bb5:   ; preds = %bb5, %bb5.outer
+   %tmp6 = tail call i32 (...)* @foo( ) nounwind   ;  
[#uses=1]
+   switch i32 %tmp6, label %bb13 [
+i32 -1, label %bb10
+i32 102, label %bb5
+i32 110, label %bb5.outer.loopexit
+   ]
 
 bb10:  ; preds = %bb5
-   %tmp11 = load i32* %undo, align 4   ;  [#uses=1]
-   %tmp12 = call i32 (...)* @bar( i32 %tmp11 ) nounwind;  
[#uses=0]
-   store i32 1, i32* %tmp, align 4
-   br label %bb13
-
-bb13:  ; preds = %bb10, %bb4
-   %tmp14 = load i32* %tmp, align 4;  [#uses=1]
-   store i32 %tmp14, i32* %retval, align 4
-   br label %return
-
-return:; preds = %bb13
-   %retval15 = load i32* %retval   ;  [#uses=1]
-   ret i32 %retval15
+   %tmp12 = tail call i32 (...)* @bar( i32 %undo.0.ph ) nounwind   
;  [#uses=0]
+   br label %UnifiedReturnBlock
+
+bb13:  ; preds = %bb5
+   br label %UnifiedReturnBlock
+
+UnifiedReturnBlock:; preds = %bb13, %bb10
+   %UnifiedRetVal = phi i32 [ 1, %bb10 ], [ 258, %bb13 ]   ;  
[#uses=1]
+   ret i32 %UnifiedRetVal
 }
 
 declare i32 @foo(...)


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r45305 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/2007-12-21-Crash.ll

2007-12-28 Thread Devang Patel

On Dec 22, 2007, at 10:45 AM, Chris Lattner wrote:

> Please just make the testcase use -simplifycfg instead of -std- 
> compile-
> opts.  The contents of -std-compile-opts can change over time and we
> want to make sure that this is testing the right thing.  Thanks!

OK. Done.
-
Devang
___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45391 - /llvm/trunk/test/Transforms/InstCombine/deadcode.ll

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Fri Dec 28 18:57:06 2007
New Revision: 45391

URL: http://llvm.org/viewvc/llvm-project?rev=45391&view=rev
Log:
upgrade this test

Modified:
llvm/trunk/test/Transforms/InstCombine/deadcode.ll

Modified: llvm/trunk/test/Transforms/InstCombine/deadcode.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/deadcode.ll?rev=45391&r1=45390&r2=45391&view=diff

==
--- llvm/trunk/test/Transforms/InstCombine/deadcode.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/deadcode.ll Fri Dec 28 18:57:06 2007
@@ -1,13 +1,14 @@
-; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \
-; RUN:   grep {ret i32 %A}
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 %A}
 
-int %test(int %A) {
-  %X = or bool false, false
-  br bool %X, label %T, label %C
-T:
-  %B = add int %A, 1
-  br label %C
-C:
-  %C = phi int [%B, %T], [%A, %0]
-  ret int %C
+define i32 @test(i32 %A) {
+   %X = or i1 false, false 
+   br i1 %X, label %T, label %C
+
+T: ; preds = %0
+   %B = add i32 %A, 1  
+   br label %C
+
+C: ; preds = %T, %0
+   %C.upgrd.1 = phi i32 [ %B, %T ], [ %A, %0 ]
+   ret i32 %C.upgrd.1
 }


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45392 - in /llvm/trunk: lib/Transforms/Utils/Local.cpp test/Transforms/InstCombine/deadcode.ll

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Fri Dec 28 18:59:12 2007
New Revision: 45392

URL: http://llvm.org/viewvc/llvm-project?rev=45392&view=rev
Log:
dead calls to llvm.stacksave can be deleted, even though they
have potential side-effects.

Modified:
llvm/trunk/lib/Transforms/Utils/Local.cpp
llvm/trunk/test/Transforms/InstCombine/deadcode.ll

Modified: llvm/trunk/lib/Transforms/Utils/Local.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/Local.cpp?rev=45392&r1=45391&r2=45392&view=diff

==
--- llvm/trunk/lib/Transforms/Utils/Local.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/Local.cpp Fri Dec 28 18:59:12 2007
@@ -17,6 +17,7 @@
 #include "llvm/DerivedTypes.h"
 #include "llvm/Instructions.h"
 #include "llvm/Intrinsics.h"
+#include "llvm/IntrinsicInst.h"
 #include "llvm/Analysis/ConstantFolding.h"
 #include "llvm/Target/TargetData.h"
 #include "llvm/Support/GetElementPtrTypeIterator.h"
@@ -173,8 +174,16 @@
 bool llvm::isInstructionTriviallyDead(Instruction *I) {
   if (!I->use_empty() || isa(I)) return false;
 
-  if (!I->mayWriteToMemory()) return true;
+  if (!I->mayWriteToMemory())
+return true;
 
+  // Special case intrinsics that "may write to memory" but can be deleted when
+  // dead.
+  if (IntrinsicInst *II = dyn_cast(I))
+// Safe to delete llvm.stacksave if dead.
+if (II->getIntrinsicID() == Intrinsic::stacksave)
+  return true;
+  
   return false;
 }
 

Modified: llvm/trunk/test/Transforms/InstCombine/deadcode.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/deadcode.ll?rev=45392&r1=45391&r2=45392&view=diff

==
--- llvm/trunk/test/Transforms/InstCombine/deadcode.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/deadcode.ll Fri Dec 28 18:59:12 2007
@@ -1,4 +1,5 @@
 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i32 %A}
+; RUN: llvm-as < %s | opt -die | llvm-dis | not grep call.*llvm.stacksave
 
 define i32 @test(i32 %A) {
%X = or i1 false, false 
@@ -12,3 +13,12 @@
%C.upgrd.1 = phi i32 [ %B, %T ], [ %A, %0 ]
ret i32 %C.upgrd.1
 }
+
+define i32* @test2(i32 %width) {
+   %tmp = call i8* @llvm.stacksave( )
+%tmp14 = alloca i32, i32 %width
+   ret i32* %tmp14
+} 
+
+declare i8* @llvm.stacksave()
+


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45393 - /llvm/trunk/lib/Target/README.txt

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Fri Dec 28 19:05:01 2007
New Revision: 45393

URL: http://llvm.org/viewvc/llvm-project?rev=45393&view=rev
Log:
expand note.


Modified:
llvm/trunk/lib/Target/README.txt

Modified: llvm/trunk/lib/Target/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/README.txt?rev=45393&r1=45392&r2=45393&view=diff

==
--- llvm/trunk/lib/Target/README.txt (original)
+++ llvm/trunk/lib/Target/README.txt Fri Dec 28 19:05:01 2007
@@ -512,6 +512,10 @@
 assertion, as it is the only one that uses it.  This happens for a lot of 
 code with early outs.
 
+Another example is loads of arguments, which are usually emitted into the 
+entry block on targets like x86.  If not used in all paths through a 
+function, they should be sunk into the ones that do.
+
 In this case, whole-function-isel would also handle this.
 
 //===-===//


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45397 - /llvm/trunk/lib/Target/X86/README.txt

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Fri Dec 28 23:51:58 2007
New Revision: 45397

URL: http://llvm.org/viewvc/llvm-project?rev=45397&view=rev
Log:
add a note

Modified:
llvm/trunk/lib/Target/X86/README.txt

Modified: llvm/trunk/lib/Target/X86/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=45397&r1=45396&r2=45397&view=diff

==
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Fri Dec 28 23:51:58 2007
@@ -1612,8 +1612,48 @@
 addl(%edx,%edi,4), %ebx
 addl%ebx, (%ecx,%edi,4)
 
-Additionally, LSR should rewrite the exit condition of the loop to use
+Here is another interesting example:
+
+void vertical_compose97iH1(int *b0, int *b1, int *b2, int width){
+int i;
+for(i=0; i>0;
+}
+
+We miss the r/m/w opportunity here by using 2 subs instead of an add+sub[mem]:
+
+LBB9_2:# bb
+   movl(%ecx,%edi,4), %ebx
+   subl(%esi,%edi,4), %ebx
+   subl(%edx,%edi,4), %ebx
+   movl%ebx, (%ecx,%edi,4)
+   incl%edi
+   cmpl%eax, %edi
+   jne LBB9_2  # bb
+
+Additionally, LSR should rewrite the exit condition of these loops to use
 a stride-4 IV, would would allow all the scales in the loop to go away.
 This would result in smaller code and more efficient microops.
 
 //===-===//
+
+We should be smarter about conversion from fpstack to XMM regs.
+
+double foo();
+void bar(double *P) { *P = foo(); }
+
+We compile that to:
+
+_bar:
+   subl$12, %esp
+   callL_foo$stub
+   fstpl   (%esp)
+   movl16(%esp), %eax
+   movsd   (%esp), %xmm0
+   movsd   %xmm0, (%eax)
+   addl$12, %esp
+   ret
+
+for example.  The magic to/from the stack is unneeded.
+
+//===-===//


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45398 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Sat Dec 29 00:26:16 2007
New Revision: 45398

URL: http://llvm.org/viewvc/llvm-project?rev=45398&view=rev
Log:
Delete a store whose input is a load from the same pointer:
  x = load p
  store x -> p

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=45398&r1=45397&r2=45398&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Dec 29 00:26:16 2007
@@ -4223,7 +4223,7 @@
   if (CombineToPreIndexedLoadStore(N) || CombineToPostIndexedLoadStore(N))
 return SDOperand(N, 0);
 
-  // FIXME: is there such a think as a truncating indexed store?
+  // FIXME: is there such a thing as a truncating indexed store?
   if (ST->isTruncatingStore() && ST->getAddressingMode() == ISD::UNINDEXED &&
   MVT::isInteger(Value.getValueType())) {
 // See if we can simplify the input to this truncstore with knowledge that
@@ -4243,6 +4243,17 @@
   return SDOperand(N, 0);
   }
   
+  // If this is a load followed by a store to the same location, then the store
+  // is dead/noop.
+  if (LoadSDNode *Ld = dyn_cast(Value)) {
+if (Chain.Val == Ld && Ld->getBasePtr() == Ptr &&
+ST->getAddressingMode() == ISD::UNINDEXED &&
+ST->getStoredVT() == Ld->getLoadedVT()) {
+  // The store is dead, remove it.
+  return Chain;
+}
+  }
+  
   return SDOperand();
 }
 


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


Re: [llvm-commits] [llvm] r45398 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-12-28 Thread Dale Johannesen

On Dec 28, 2007, at 10:26 PM, Chris Lattner wrote:

> Author: lattner
> Date: Sat Dec 29 00:26:16 2007
> New Revision: 45398
>
> URL: http://llvm.org/viewvc/llvm-project?rev=45398&view=rev
> Log:
> Delete a store whose input is a load from the same pointer:
>  x = load p
>  store x -> p

This is unsafe for volatile.  I don't see a check?

>
> Modified:
>llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
>
> Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=45398&r1=45397&r2=45398&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ==
> --- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
> +++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Dec 29  
> 00:26:16 2007
> @@ -4223,7 +4223,7 @@
>   if (CombineToPreIndexedLoadStore(N) ||  
> CombineToPostIndexedLoadStore(N))
> return SDOperand(N, 0);
>
> -  // FIXME: is there such a think as a truncating indexed store?
> +  // FIXME: is there such a thing as a truncating indexed store?
>   if (ST->isTruncatingStore() && ST->getAddressingMode() ==  
> ISD::UNINDEXED &&
>   MVT::isInteger(Value.getValueType())) {
> // See if we can simplify the input to this truncstore with  
> knowledge that
> @@ -4243,6 +4243,17 @@
>   return SDOperand(N, 0);
>   }
>
> +  // If this is a load followed by a store to the same location,  
> then the store
> +  // is dead/noop.
> +  if (LoadSDNode *Ld = dyn_cast(Value)) {
> +if (Chain.Val == Ld && Ld->getBasePtr() == Ptr &&
> +ST->getAddressingMode() == ISD::UNINDEXED &&
> +ST->getStoredVT() == Ld->getLoadedVT()) {
> +  // The store is dead, remove it.
> +  return Chain;
> +}
> +  }
> +
>   return SDOperand();
> }
>
>
>
> ___
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45399 - in /llvm/trunk: lib/Target/X86/README.txt lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/fp-stack-ret-store.ll

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Sat Dec 29 00:41:28 2007
New Revision: 45399

URL: http://llvm.org/viewvc/llvm-project?rev=45399&view=rev
Log:
avoid going through a stack slot to convert from fpstack to xmm reg
if we are just going to store it back anyway.  This improves things 
like:
double foo();
void bar(double *P) { *P = foo(); }


Added:
llvm/trunk/test/CodeGen/X86/fp-stack-ret-store.ll
Modified:
llvm/trunk/lib/Target/X86/README.txt
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/README.txt
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/README.txt?rev=45399&r1=45398&r2=45399&view=diff

==
--- llvm/trunk/lib/Target/X86/README.txt (original)
+++ llvm/trunk/lib/Target/X86/README.txt Sat Dec 29 00:41:28 2007
@@ -1636,24 +1636,3 @@
 This would result in smaller code and more efficient microops.
 
 //===-===//
-
-We should be smarter about conversion from fpstack to XMM regs.
-
-double foo();
-void bar(double *P) { *P = foo(); }
-
-We compile that to:
-
-_bar:
-   subl$12, %esp
-   callL_foo$stub
-   fstpl   (%esp)
-   movl16(%esp), %eax
-   movsd   (%esp), %xmm0
-   movsd   %xmm0, (%eax)
-   addl$12, %esp
-   ret
-
-for example.  The magic to/from the stack is unneeded.
-
-//===-===//

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=45399&r1=45398&r2=45399&view=diff

==
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Dec 29 00:41:28 2007
@@ -33,7 +33,6 @@
 #include "llvm/CodeGen/SelectionDAG.h"
 #include "llvm/CodeGen/SSARegMap.h"
 #include "llvm/Support/MathExtras.h"
-#include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/ADT/SmallSet.h"
@@ -812,7 +811,6 @@
   CCState CCInfo(CallingConv, isVarArg, getTargetMachine(), RVLocs);
   CCInfo.AnalyzeCallResult(TheCall, RetCC_X86);
 
-  
   SmallVector ResultVals;
   
   // Copy all of the result registers out of their specified physreg.
@@ -838,17 +836,50 @@
 // an XMM register.
 if ((X86ScalarSSEf32 && RVLocs[0].getValVT() == MVT::f32) ||
 (X86ScalarSSEf64 && RVLocs[0].getValVT() == MVT::f64)) {
+  SDOperand StoreLoc;
+  const Value *SrcVal = 0;
+  int SrcValOffset = 0;
+  
+  // Determine where to store the value.  If the call result is directly
+  // used by a store, see if we can store directly into the location.  In
+  // this case, we'll end up producing a fst + movss[load] + movss[store] 
to
+  // the same location, and the two movss's will be nuked as dead.  This
+  // optimizes common things like "*D = atof(..)" to not need an
+  // intermediate stack slot.
+  if (SDOperand(TheCall, 0).hasOneUse() && 
+  SDOperand(TheCall, 1).hasOneUse()) {
+// Ok, we have one use of the value and one use of the chain.  See if
+// they are the same node: a store.
+if (StoreSDNode *N = dyn_cast(*TheCall->use_begin())) {
+  if (N->getChain().Val == TheCall && N->getValue().Val == TheCall &&
+  !N->isVolatile() && !N->isTruncatingStore() && 
+  N->getAddressingMode() == ISD::UNINDEXED) {
+StoreLoc = N->getBasePtr();
+SrcVal = N->getSrcValue();
+SrcValOffset = N->getSrcValueOffset();
+  }
+}
+  }
+
+  // If we weren't able to optimize the result, just create a temporary
+  // stack slot.
+  if (StoreLoc.Val == 0) {
+MachineFunction &MF = DAG.getMachineFunction();
+int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8);
+StoreLoc = DAG.getFrameIndex(SSFI, getPointerTy());
+  }
+  
   // FIXME: Currently the FST is flagged to the FP_GET_RESULT. This
   // shouldn't be necessary except that RFP cannot be live across
-  // multiple blocks. When stackifier is fixed, they can be uncoupled.
-  MachineFunction &MF = DAG.getMachineFunction();
-  int SSFI = MF.getFrameInfo()->CreateStackObject(8, 8);
-  SDOperand StackSlot = DAG.getFrameIndex(SSFI, getPointerTy());
+  // multiple blocks (which could happen if a select gets lowered into
+  // multiple blocks and scheduled in between them). When stackifier is
+  // fixed, they can be uncoupled.
   SDOperand Ops[] = {
-Chain, RetVal, StackSlot, DAG.getValueType(RVLocs[0].getValVT()), 
InFlag
+Chain, RetVal, StoreLoc, DAG.getValueType(RVLocs[0].getValVT()), InFlag
   };
   Chain = DAG.getNode(X86ISD::FST, MVT::Other, Ops, 5);
-  Re

[llvm-commits] [llvm] r45400 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Sat Dec 29 00:55:23 2007
New Revision: 45400

URL: http://llvm.org/viewvc/llvm-project?rev=45400&view=rev
Log:
don't fold fp_round(fp_extend(load)) -> fp_round(extload)

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=45400&r1=45399&r2=45400&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Dec 29 00:55:23 2007
@@ -3672,6 +3672,10 @@
   ConstantFPSDNode *N0CFP = dyn_cast(N0);
   MVT::ValueType VT = N->getValueType(0);
   
+  // If this is fp_round(fpextend), don't fold it, allow ourselves to be 
folded.
+  if (N->hasOneUse() && (*N->use_begin())->getOpcode() == ISD::FP_ROUND)
+return SDOperand();
+  
   // fold (fp_extend c1fp) -> c1fp
   if (N0CFP && VT != MVT::ppcf128)
 return DAG.getNode(ISD::FP_EXTEND, VT, N0);


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45401 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/fp-stack-ret-store.ll

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Sat Dec 29 00:57:38 2007
New Revision: 45401

URL: http://llvm.org/viewvc/llvm-project?rev=45401&view=rev
Log:
Codegen:

as:

_bar:
pushl   %esi
subl$8, %esp
movl16(%esp), %esi
callL_foo$stub
fstps   (%esi)
addl$8, %esp
popl%esi
#FP_REG_KILL
ret

instead of:

_bar:
pushl   %esi
subl$8, %esp
movl16(%esp), %esi
callL_foo$stub
fstpl   (%esi)
cvtsd2ss(%esi), %xmm0
movss   %xmm0, (%esi)
addl$8, %esp
popl%esi
#FP_REG_KILL
ret


Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/fp-stack-ret-store.ll

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=45401&r1=45400&r2=45401&view=diff

==
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Dec 29 00:57:38 2007
@@ -839,6 +839,7 @@
   SDOperand StoreLoc;
   const Value *SrcVal = 0;
   int SrcValOffset = 0;
+  MVT::ValueType RetStoreVT = RVLocs[0].getValVT();
   
   // Determine where to store the value.  If the call result is directly
   // used by a store, see if we can store directly into the location.  In
@@ -848,15 +849,34 @@
   // intermediate stack slot.
   if (SDOperand(TheCall, 0).hasOneUse() && 
   SDOperand(TheCall, 1).hasOneUse()) {
+// In addition to direct uses, we also support a FP_ROUND that uses the
+// value, if it is directly stored somewhere.
+SDNode *User = *TheCall->use_begin();
+if (User->getOpcode() == ISD::FP_ROUND && User->hasOneUse())
+  User = *User->use_begin();
+
 // Ok, we have one use of the value and one use of the chain.  See if
 // they are the same node: a store.
-if (StoreSDNode *N = dyn_cast(*TheCall->use_begin())) {
-  if (N->getChain().Val == TheCall && N->getValue().Val == TheCall &&
+if (StoreSDNode *N = dyn_cast(User)) {
+  // Verify that the value being stored is either the call or a
+  // truncation of the call.
+  SDNode *StoreVal = N->getValue().Val;
+  if (StoreVal == TheCall)
+; // ok.
+  else if (StoreVal->getOpcode() == ISD::FP_ROUND &&
+   StoreVal->hasOneUse() && 
+   StoreVal->getOperand(0).Val == TheCall)
+; // ok.
+  else
+N = 0;  // not ok.
+
+  if (N && N->getChain().Val == TheCall &&
   !N->isVolatile() && !N->isTruncatingStore() && 
   N->getAddressingMode() == ISD::UNINDEXED) {
 StoreLoc = N->getBasePtr();
 SrcVal = N->getSrcValue();
 SrcValOffset = N->getSrcValueOffset();
+RetStoreVT = N->getValue().getValueType();
   }
 }
   }
@@ -875,12 +895,17 @@
   // multiple blocks and scheduled in between them). When stackifier is
   // fixed, they can be uncoupled.
   SDOperand Ops[] = {
-Chain, RetVal, StoreLoc, DAG.getValueType(RVLocs[0].getValVT()), InFlag
+Chain, RetVal, StoreLoc, DAG.getValueType(RetStoreVT), InFlag
   };
   Chain = DAG.getNode(X86ISD::FST, MVT::Other, Ops, 5);
-  RetVal = DAG.getLoad(RVLocs[0].getValVT(), Chain,
+  RetVal = DAG.getLoad(RetStoreVT, Chain,
StoreLoc, SrcVal, SrcValOffset);
   Chain = RetVal.getValue(1);
+  
+  // If we optimized a truncate, then extend the result back to its desired
+  // type.
+  if (RVLocs[0].getValVT() != RetStoreVT)
+RetVal = DAG.getNode(ISD::FP_EXTEND, RVLocs[0].getValVT(), RetVal);
 }
 ResultVals.push_back(RetVal);
   }

Modified: llvm/trunk/test/CodeGen/X86/fp-stack-ret-store.ll
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/fp-stack-ret-store.ll?rev=45401&r1=45400&r2=45401&view=diff

==
--- llvm/trunk/test/CodeGen/X86/fp-stack-ret-store.ll (original)
+++ llvm/trunk/test/CodeGen/X86/fp-stack-ret-store.ll Sat Dec 29 00:57:38 2007
@@ -13,3 +13,14 @@
 }
 
 declare double @foo(...)
+
+define void @bar2(float* %P) {
+entry:
+   %tmp = tail call double (...)* @foo2( ) ;  [#uses=1]
+   %tmp1 = fptrunc double %tmp to float;  [#uses=1]
+   store float %tmp1, float* %P, align 4
+   ret void
+}
+
+declare double @foo2(...)
+


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits


[llvm-commits] [llvm] r45402 - /llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

2007-12-28 Thread Chris Lattner
Author: lattner
Date: Sat Dec 29 01:15:45 2007
New Revision: 45402

URL: http://llvm.org/viewvc/llvm-project?rev=45402&view=rev
Log:
make sure not to zap volatile stores, thanks a lot to Dale for noticing this!

Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=45402&r1=45401&r2=45402&view=diff

==
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Sat Dec 29 01:15:45 2007
@@ -4252,7 +4252,8 @@
   if (LoadSDNode *Ld = dyn_cast(Value)) {
 if (Chain.Val == Ld && Ld->getBasePtr() == Ptr &&
 ST->getAddressingMode() == ISD::UNINDEXED &&
-ST->getStoredVT() == Ld->getLoadedVT()) {
+ST->getStoredVT() == Ld->getLoadedVT() &&
+!ST->isVolatile()) {
   // The store is dead, remove it.
   return Chain;
 }


___
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits