[llvm-commits] [llvm] r125465 - in /llvm/trunk: include/llvm/CodeGen/ISDOpcodes.h lib/CodeGen/SelectionDAG/DAGCombiner.cpp lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp lib/CodeGen/SelectionDAG/SelectionDAG.cpp lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Chris Lattner clattner at apple.com
Sun Feb 13 11:57:31 PST 2011


On Feb 13, 2011, at 11:23 AM, Duncan Sands wrote:

> Hi Chris,
> 
>> +    /// Shift and rotation operations.  After legalization, the type of the
>> +    /// shift amount is known to be TLI.getShiftAmountTy().  Before legalization
>> +    /// the shift amount can be any type, but care must be taken to ensure it is
>> +    /// large enough.  TLI.getShiftAmountTy() is i8 on some targets, but before
>> +    /// legalization, types like i1024 can occur and i8 doesn't have enough bits
>> +    /// to represent the shift amount.  By convention, DAGCombine and IRBuilder
>> +    /// forces these shift amounts to i32 for simplicity.
> 
> IRBuilder -> SelectionDAGBuilder.  Another solution is to use the type of the
> first operand for the type of the shift amount (like is done in the IR).  That
> would get rid of inelegant logic like the following:

I considered that, the problem is that code will have to carefully consider whether its running pre or post-legalize.

-Chris



More information about the llvm-commits mailing list