[llvm-commits] [llvm] r121674 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_create.ll

Frits van Bommel fvbommel at gmail.com
Mon Dec 13 02:59:24 PST 2010

On Mon, Dec 13, 2010 at 11:34 AM, Frits van Bommel <fvbommel at gmail.com> wrote:
> On Mon, Dec 13, 2010 at 4:43 AM, Chris Lattner <sabre at nondot.org> wrote:
>> +  // Ok, the block is reachable from the default dest.  If the constant we're
>> +  // comparing exists in one of the other edges, then we can constant fold ICI
>> +  // and zap it.
>> +  if (SI->findCaseValue(Cst) != 0) {
> This should probably also make sure the successor for that case isn't
> equal to BB. (Yes, this is an even *more* degenerate case since BB is
> the default destination of the switch, but it's valid IR...)

> By the way, the "if (SI->getDefaultDest() != BB)" just before this
> doesn't seem to handle the case where multiple cases jump to BB.

Never mind, none of this code is reachable if there's more than one edge.
I either overlooked the "return false if !BB->getSinglePredecessor()"
code above it or forgot that getSinglePredecessor !=

More information about the llvm-commits mailing list