[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp

Duncan Sands baldrick at free.fr
Thu Jun 28 03:09:40 PDT 2007


Hi,

> > It seems like folding undef/X to undef isn't safe either though, with
> > the way it sounds like undef is intended to work. This code:
> >
> >   %x = udiv i32 undef, %intmax
> >   %y = udiv i32 %x, 2
> >
> > will always set %y to 0. Maybe instcombine can fold the second
> > udiv by looking through its operands, but it can't safely fold the
> > first. The best it could do is try to fold away all of %x's uses so
> > that %x isn't needed anymore.

presumably undef/X should be folded to 0.  [This means that undef/0 gets
folded to 0, not sure if that's OK].

Ciao,

D.



More information about the llvm-commits mailing list