[llvm-commits] [llvm] r39839 - /llvm/trunk/lib/Transforms/Scalar/FastDSE.cpp

Chris Lattner clattner at apple.com
Fri Jul 13 16:06:17 PDT 2007


> Handle GEPs with all-zero indices in the same way we handle pointer- 
> pointer bitcasts. Also, fix a potentia infinite loop.

Nifty.

> +      while (isa<BitCastInst>(v) || isa<GetElementPtrInst>(v))
> +        if (BitCastInst* C = dyn_cast<BitCastInst>(v)) {
> +          if (isa<PointerType>(C->getSrcTy()))
> +            v = C->getOperand(0);
> +          else
> +            break;

Note that if you know the result type of a bitcast is a pointer, that  
you are guaranteed that the operand is also a pointer type, there is  
no need to check.

-Chris



More information about the llvm-commits mailing list