[llvm-commits] CAST Patch Update [1/4] first third of the patch.

Reid Spencer rspencer at reidspencer.com
Sun Nov 12 20:25:58 PST 2006


Chris,

I have a meta-comment on your review. The ConvertInst::getCast and
ConstantExpr::getCast methods work.  Many of your review comments claim
they don't. I should have primed you for this but didn't have time.
Here's why it works:

1. These two methods are temporary. They were introduced to minimize the
size of the cast patch. Its already 5 times larger than previous patches
in this series. Without them it would be much larger still.

2. While the integer types are signed these methods work correctly
because there is only one cast opcode that is suitable for any given
pair of first class types. Consequently all the "new CastInst(...)"
calls can be replaced with "ConvertInst::getCast(...)" calls which
simply determine the (only) opcode that is suitable.

3. When all the instruction changes are done (SETCC, GEP, CALL remain)
we will revisit each call site for these methods and determine how to
replace the getCast call with the instantiation of the correct cast
instruction (most likely via getConvert which takes an opcode as the
first argument).

You have pointed out many instances where the calls to getCast would be
dangerous if the integer types became signless.  However, that is not
the case currently.  I consider every single one of them dangerous and
they will all be removed before we make the integer types signless.

If there's something provably wrong with this strategy, please inform
me. I'm trying to keep your review work minimized.

Reid.






More information about the llvm-commits mailing list