From: Chris Lattner Date: Sun, 2 Apr 2006 05:37:12 +0000 (+0000) Subject: Allow transforming this: X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a1c3538537b853482479222b50810a16be7b04c9;p=oota-llvm.git Allow transforming this: %tmp = cast <4 x uint>* %testData to <4 x int>* ; <<4 x int>*> [#uses=1] %tmp = load <4 x int>* %tmp ; <<4 x int>> [#uses=1] to this: %tmp = load <4 x uint>* %testData ; <<4 x uint>> [#uses=1] %tmp = cast <4 x uint> %tmp to <4 x int> ; <<4 x int>> [#uses=1] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27353 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 3697b2a5148..82e70073e83 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -6234,7 +6234,8 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) { if (const PointerType *SrcTy = dyn_cast(CastOp->getType())) { const Type *SrcPTy = SrcTy->getElementType(); - if (DestPTy->isInteger() || isa(DestPTy)) { + if (DestPTy->isInteger() || isa(DestPTy) || + isa(DestPTy)) { // If the source is an array, the code below will not succeed. Check to // see if a trivial 'gep P, 0, 0' will help matters. Only do this for // constants. @@ -6247,7 +6248,8 @@ static Instruction *InstCombineLoadCast(InstCombiner &IC, LoadInst &LI) { SrcPTy = SrcTy->getElementType(); } - if ((SrcPTy->isInteger() || isa(SrcPTy)) && + if ((SrcPTy->isInteger() || isa(SrcPTy) || + isa(SrcPTy)) && // Do not allow turning this into a load of an integer, which is then // casted to a pointer, this pessimizes pointer analysis a lot. (isa(SrcPTy) == isa(LI.getType())) &&