[llvm-commits] [llvm] r138722 - in /llvm/trunk: lib/Analysis/ConstantFolding.cpp lib/Transforms/InstCombine/InstCombineCasts.cpp test/Transforms/InstCombine/cast.ll
Duncan Sands
baldrick at free.fr
Mon Aug 29 06:11:00 PDT 2011
Hi Nadav,
> --- lib/VMCore/Instructions.cpp (revision 138427)
> +++ lib/VMCore/Instructions.cpp (working copy)
> @@ -2114,10 +2114,12 @@
>
> // If either of the casts are a bitcast from scalar to vector, disallow the
> // merging.
> - if ((firstOp == Instruction::BitCast &&
> + // Bitcasts of A->B->A are okay.
> + if ((SrcTy != DstTy) &&
> + ((firstOp == Instruction::BitCast &&
> isa<VectorType>(SrcTy) != isa<VectorType>(MidTy)) ||
> (secondOp == Instruction::BitCast &&
> - isa<VectorType>(MidTy) != isa<VectorType>(DstTy)))
> + isa<VectorType>(MidTy) != isa<VectorType>(DstTy))))
> return 0; // Disallowed
I think it would be better to say that it is OK if both instructions are
bitcasts. The problematic case seems to be when one is a bitcast and the
other is not (PR7311).
Ciao, Duncan.
>
> int ElimCase = CastResults[firstOp-Instruction::CastOpsBegin]
More information about the llvm-commits
mailing list