mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
[InstCombine] Disable recursion in foldGEPICmp for vector pointer GEPs
Due to missing vector support in this function, recursion can generate worse code in some cases. llvm-svn: 370221
This commit is contained in:
parent
7239307170
commit
a8988785a1
@ -988,12 +988,14 @@ Instruction *InstCombiner::foldGEPICmp(GEPOperator *GEPLHS, Value *RHS,
|
||||
}
|
||||
|
||||
// If one of the GEPs has all zero indices, recurse.
|
||||
if (GEPLHS->hasAllZeroIndices())
|
||||
// FIXME: Handle vector of pointers.
|
||||
if (!GEPLHS->getType()->isVectorTy() && GEPLHS->hasAllZeroIndices())
|
||||
return foldGEPICmp(GEPRHS, GEPLHS->getOperand(0),
|
||||
ICmpInst::getSwappedPredicate(Cond), I);
|
||||
|
||||
// If the other GEP has all zero indices, recurse.
|
||||
if (GEPRHS->hasAllZeroIndices())
|
||||
// FIXME: Handle vector of pointers.
|
||||
if (!GEPRHS->getType()->isVectorTy() && GEPRHS->hasAllZeroIndices())
|
||||
return foldGEPICmp(GEPLHS, GEPRHS->getOperand(0), Cond, I);
|
||||
|
||||
bool GEPsInBounds = GEPLHS->isInBounds() && GEPRHS->isInBounds();
|
||||
|
@ -110,6 +110,18 @@ define <2 x i1> @test6(<2 x i32> %X, <2 x %S*> %P) nounwind {
|
||||
ret <2 x i1> %C
|
||||
}
|
||||
|
||||
; Same as above, but indices scalarized.
|
||||
define <2 x i1> @test6b(<2 x i32> %X, <2 x %S*> %P) nounwind {
|
||||
; CHECK-LABEL: @test6b(
|
||||
; CHECK-NEXT: [[C:%.*]] = icmp eq <2 x i32> [[X:%.*]], <i32 1073741823, i32 1073741823>
|
||||
; CHECK-NEXT: ret <2 x i1> [[C]]
|
||||
;
|
||||
%A = getelementptr inbounds %S, <2 x %S*> %P, i32 0, i32 1, <2 x i32> %X
|
||||
%B = getelementptr inbounds %S, <2 x %S*> %P, i32 0, i32 0
|
||||
%C = icmp eq <2 x i32*> %A, %B
|
||||
ret <2 x i1> %C
|
||||
}
|
||||
|
||||
@G = external global [3 x i8]
|
||||
define i8* @test7(i16 %Idx) {
|
||||
; CHECK-LABEL: @test7(
|
||||
|
Loading…
x
Reference in New Issue
Block a user