llvm.org GIT mirror llvm / 278be78
Revert "SimplifyCFG: GEPs with just one non-constant index are also cheap." Yes, there are other types than i8* and GEPs on them can produce an add+multiply. We don't consider that cheap enough to be speculatively executed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126481 91177308-0d34-0410-b5e6-96231b3b80d8 Benjamin Kramer 8 years ago
2 changed file(s) with 4 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
246246 if (PBB->getFirstNonPHIOrDbg() != I)
247247 return false;
248248 break;
249 case Instruction::GetElementPtr: {
250 // GEPs are cheap if all indices are constant or if there's only one index.
251 GetElementPtrInst *GEP = cast(I);
252 if (!GEP->hasAllConstantIndices() && GEP->getNumIndices() > 1)
249 case Instruction::GetElementPtr:
250 // GEPs are cheap if all indices are constant.
251 if (!cast(I)->hasAllConstantIndices())
253252 return false;
254253 break;
255 }
256254 case Instruction::Add:
257255 case Instruction::Sub:
258256 case Instruction::And:
1414 ret i8* %x.addr
1515
1616 ; CHECK: @test1
17 ; CHECK: %x.addr = select i1 %cmp, i8* %incdec.ptr, i8* %x
17 ; CHECK-NOT: select
1818 ; CHECK: ret i8* %x.addr
1919 }
2020