Skip to content

Commit

Permalink
with recent work, we now optimize this into:
Browse files Browse the repository at this point in the history
define i32 @foo(i32 %x) nounwind readnone ssp {
entry:
  %tobool = icmp eq i32 %x, 0
  %tmp5 = select i1 %tobool, i32 2, i32 1
  ret i32 %tmp5
}



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124091 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
lattner committed Jan 24, 2011
1 parent e335786 commit 7ea7d32
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions lib/Target/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1270,26 +1270,6 @@ SingleSource/Benchmarks/Misc/dt.c

//===---------------------------------------------------------------------===//

A/B get pinned to the stack because we turn an if/then into a select instead
of PRE'ing the load/store. This may be fixable in instcombine:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37892

struct X { int i; };
int foo (int x) {
struct X a;
struct X b;
struct X *p;
a.i = 1;
b.i = 2;
if (x)
p = &a;
else
p = &b;
return p->i;
}

//===---------------------------------------------------------------------===//

Interesting missed case because of control flow flattening (should be 2 loads):
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26629
With: llvm-gcc t2.c -S -o - -O0 -emit-llvm | llvm-as |
Expand Down

0 comments on commit 7ea7d32

Please sign in to comment.