mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 20:51:35 +00:00
RegionGenerator: Only introduce subregion.ivs for loops fully within a subregion
IVs of loops for which the loop header is in the subregion, but not the entire loop may be incremented outside of the subregion and can consequently not be kept private to the subregion. Instead, they need to and are modeled as virtual loops in the iteration domains. As this is the case, generating new subregion induction variables for such loops is not needed and indeed wrong as they would hide the virtual induction variables modeled in the scop. This fixes a miscompile in MultiSource/Benchmarks/Ptrdist/bc and MultiSource/Benchmarks/nbench/. Thanks Michael and Johannes for their investiagations and helpful observations regarding this bug. llvm-svn: 252860
This commit is contained in:
parent
6400fc146e
commit
bc29e0b27c
@ -1141,7 +1141,7 @@ void RegionGenerator::copyStmt(ScopStmt &Stmt, LoopToScevMapT <S,
|
||||
// replacement for SCEVs refering to the old loop.
|
||||
for (BasicBlock *BB : SeenBlocks) {
|
||||
Loop *L = LI.getLoopFor(BB);
|
||||
if (L == nullptr || L->getHeader() != BB)
|
||||
if (L == nullptr || L->getHeader() != BB || !R->contains(L))
|
||||
continue;
|
||||
|
||||
BasicBlock *BBCopy = BlockMap[BB];
|
||||
|
@ -13,11 +13,9 @@ loop:
|
||||
br i1 %cond0, label %branch1, label %backedge
|
||||
|
||||
; CHECK-LABEL: polly.stmt.loop:
|
||||
; CHECK-NEXT: %polly.subregion.iv = phi i32 [ 0, %polly.stmt.loop.entry ]
|
||||
; CHECK-NEXT: %p_val0 = fadd float 1.000000e+00, 2.000000e+00
|
||||
; CHECK-NEXT: %p_val1 = fadd float 1.000000e+00, 2.000000e+00
|
||||
; CHECK-NEXT: %p_val2 = fadd float 1.000000e+00, 2.000000e+00
|
||||
; CHECK-NEXT: %polly.subregion.iv.inc = add i32 %polly.subregion.iv, 1
|
||||
; CHECK-NEXT: store float %p_val0, float* %merge.phiops
|
||||
; CHECK-NEXT: br i1
|
||||
|
||||
|
@ -12,10 +12,8 @@ loop:
|
||||
br i1 %cond0, label %branch1, label %backedge
|
||||
|
||||
; CHECK-LABEL: polly.stmt.loop:
|
||||
; CHECK-NEXT: %polly.subregion.iv = phi i32 [ 0, %polly.stmt.loop.entry ]
|
||||
; CHECK-NEXT: %p_val0 = fadd float 1.000000e+00, 2.000000e+00
|
||||
; CHECK-NEXT: %p_val1 = fadd float 1.000000e+00, 2.000000e+00
|
||||
; CHECK-NEXT: %polly.subregion.iv.inc = add i32 %polly.subregion.iv, 1
|
||||
; CHECK-NEXT: store float %p_val0, float* %merge.phiops
|
||||
; CHECK-NEXT: br i1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user