mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-27 00:21:03 +00:00
GEPs with all zero indices are trivially coalesced by fast-isel. For example,
%arrayidx135 = getelementptr inbounds [4 x [4 x [4 x [4 x i32]]]]* %M0, i32 0, i64 0 %arrayidx136 = getelementptr inbounds [4 x [4 x [4 x i32]]]* %arrayidx135, i32 0, i64 %idxprom134 Prior to this commit, the GEP instruction that defines %arrayidx136 thought that %arrayidx135 was a trivial kill. The GEP that defines %arrayidx135 doesn't generate any code and thus %M0 gets folded into the second GEP. Thus, we need to look through GEPs with all zero indices. rdar://10443319 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@144730 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -96,6 +96,11 @@ bool FastISel::hasTrivialKill(const Value *V) const {
|
|||||||
!hasTrivialKill(Cast->getOperand(0)))
|
!hasTrivialKill(Cast->getOperand(0)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// GEPs with all zero indices are trivially coalesced by fast-isel.
|
||||||
|
if (const GetElementPtrInst *GEP = dyn_cast<GetElementPtrInst>(I))
|
||||||
|
if (GEP->hasAllZeroIndices() && !hasTrivialKill(GEP->getOperand(0)))
|
||||||
|
return false;
|
||||||
|
|
||||||
// Only instructions with a single use in the same basic block are considered
|
// Only instructions with a single use in the same basic block are considered
|
||||||
// to have trivial kills.
|
// to have trivial kills.
|
||||||
return I->hasOneUse() &&
|
return I->hasOneUse() &&
|
||||||
|
Reference in New Issue
Block a user