Chris Lattner wrote:
> On Mar 23, 2007, at 11:46 AM, Reid Spencer wrote:
> 
>>   // shl uint X, 32 = 0 and shr ubyte Y, 9 = 0, ... just don't  
>>eliminate shr
>>   // of a signed value.
>>   //
>>-  unsigned TypeBits = Op0->getType()->getPrimitiveSizeInBits();
>>-  if (Op1->getZExtValue() >= TypeBits) {
>>+  if (Op1->getZExtValue() >= TypeBits) {  // shift amount always  
>><= 32 bits
> 
> 
> This isn't safe.  Code like:
> 
> shl i1024 %A, 123456789123456789123456789123456789
> 
> is undefined but legal.  The compiler should not crash on it.

What exactly is undefined? Just the result of that single instruction,
or the behaviour of any program that attempts to execute it? Would it be
acceptable to replace such an instruction with "unreachable"?

If so, then it gives me a new source of information for predsimplify.
After the instruction executes, I can assume that the RHS of a shift is
within range.

Nick Lewycky
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to