[llvm-commits] [llvm] r138722 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp lib/Transforms/InstCombine/InstCombineCasts.cpp test/Transforms/InstCombine/cast.ll

Rotem, Nadav nadav.rotem at intel.com
Sun Aug 28 12:14:16 PDT 2011


Hi Chris, 

I am not sure I understand the following rule in isEliminableCastPair:

02115   // If either of the casts are a bitcast from scalar to vector, disallow the
02116   // merging.
02117   if ((firstOp == Instruction::BitCast &&
02118        isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
02119       (secondOp == Instruction::BitCast &&
02120        isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
02121     return 0; // Disallowed

I think that it is okay to simplify the bitcast A->B->A regardless of the type. Am I missing something ?


Thanks, 
Nadav



-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Chris Lattner
Sent: Sunday, August 28, 2011 19:36
To: Duncan Sands
Cc: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [llvm] r138722 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp lib/Transforms/InstCombine/InstCombineCasts.cpp test/Transforms/InstCombine/cast.ll


On Aug 28, 2011, at 5:07 AM, Duncan Sands wrote:

> Hi Nadav,
> 
>> Bitcasts are transitive. Bitcast-Bitcast-X becomes Bitcast-X.
> 
> sadly this is not true because you are only allowed to bitcast an mmx type
> to and from a vector type, but you can bitcast vector to and from integers
> etc.

See also CastInst::isEliminableCastPair.

-Chris
_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
---------------------------------------------------------------------
Intel Israel (74) Limited

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.





More information about the llvm-commits mailing list