Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polly fails in tools/polly/lib/IndependentBlocks.cpp:539 with assert "Cannot generate independent blocks" #12681

Closed
sebpop mannequin opened this issue Mar 19, 2012 · 7 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate polly

Comments

@sebpop
Copy link
Mannequin

sebpop mannequin commented Mar 19, 2012

Bugzilla Link 12309
Resolution DUPLICATE
Resolved on Jan 18, 2016 17:02
Version unspecified
OS Linux
Attachments reduced bug bytecode
CC @etherzhhb,@jdoerfert

Extended Description

To reproduce:

$ opt -load LLVMPolly.so -polly foo.ll -basicaa -polly-region-simplify -polly-codegen -lower-expect
opt: /prj/dsp/austin/llvm/test/users/spop/build/hexagon/llvm-mainline-081f52b-clang-mainline-6aaf0c9-polly-master-2439c4a/tools/polly/lib/IndependentBlocks.cpp:539: void::IndependentBlocks::verifyScop(const llvm::Region*) const: Assertion `areAllBlocksIndependent(R) && "Cannot generate independent blocks"' failed.
0 opt 0x0000000000bfb9b1
1 opt 0x0000000000bfb7a4
2 libpthread.so.0 0x00002b43a5d46e00
3 libc.so.6 0x00002b43a63f6f45 gsignal + 53
4 libc.so.6 0x00002b43a63f8340 abort + 272
5 libc.so.6 0x00002b43a63f0486 __assert_fail + 246
6 LLVMPolly.so 0x00002b43a66c24ef
7 LLVMPolly.so 0x00002b43a66c2480
8 opt 0x0000000000b835a4 llvm::PMDataManager::verifyPreservedAnalysis(llvm::Pass*) + 192
9 opt 0x00000000009954a2 llvm::RGPassManager::runOnFunction(llvm::Function&) + 1336
10 opt 0x0000000000b86252 llvm::FPPassManager::runOnFunction(llvm::Function&) + 432
11 opt 0x0000000000b8649d llvm::FPPassManager::runOnModule(llvm::Module&) + 107
12 opt 0x0000000000b867e0 llvm::MPPassManager::runOnModule(llvm::Module&) + 456
13 opt 0x0000000000b86cf6 llvm::PassManagerImpl::run(llvm::Module&) + 130
14 opt 0x0000000000b86ff1 llvm::PassManager::run(llvm::Module&) + 39
15 opt 0x00000000006412ec main + 4683
16 libc.so.6 0x00002b43a63e4304 __libc_start_main + 244
17 opt 0x0000000000632269
Stack dump:
0. Program arguments: opt -load LLVMPolly.so -polly foo.ll -basicaa -polly-region-simplify -polly-codegen -lower-expect

  1.  Running pass 'Function Pass Manager' on module 'foo.ll'.
    
  2.  Running pass 'Region Pass Manager' on function '@foo'
    

Aborted

@sebpop
Copy link
Mannequin Author

sebpop mannequin commented Mar 19, 2012

assigned to @etherzhhb

@etherzhhb
Copy link
Mannequin

etherzhhb mannequin commented Mar 21, 2012

This is a bug in the IndependentBlocks pass.

The bug can be reproduced by:
opt -load LLVMPolly.so -polly -basicaa -polly-region-simplify -polly-codegen

But everything seems ok with:
opt -load LLVMPolly.so -polly -basicaa -polly-region-simplify -polly-independent

So i doubt that the CodeGeneration pass broken the independent blocks. I will have a look.

PS: The bug cannot be reproduced in 32bit ubuntu.

@etherzhhb
Copy link
Mannequin

etherzhhb mannequin commented Mar 26, 2012

The patch that partial fix the bug
This patch disable independent blocks verification for the scops that have been
codegened. However the case is still fail opt because codegen pass broken the
ssa form.

I run:
llvm-build/bin/opt -load /home/bot/pollywork/polly-prj/test/../lib/LLVMPolly.so -basicaa -polly-prepare -polly-region-simplify -scev-aa -polly-codegen -disable-verify /home/bot/pollywork/polly/test/ScopDetection/codegen-break-indepblocks.ll -o - | llvm-build/bin/opt

got:
Instruction does not dominate all uses!
%shl = shl i32 1, %np
%2 = mul i32 1, %shl
Instruction does not dominate all uses!
%shl = shl i32 1, %np
%4 = mul i32 2, %shl
Broken module found, compilation aborted!
Stack dump:
0. Program arguments: llvm-build/bin/opt

  1. Running pass 'Function Pass Manager' on module ''.
  2. Running pass 'Module Verifier' on function '@foo'
    Aborted

@sebpop
Copy link
Mannequin Author

sebpop mannequin commented Apr 8, 2013

testcase
The attached testcase fails in IndependentBlocks.cpp:546

There are two scops. The problem is that the second scop uses a variable defined in the first scop "%nf.0.reload".

As the analysis of parameters has been performed for all the scops before starting to generate code, there are parameters that refer to SSA names of the original code of the first scop, and after we generate code for the parameters of the second scop with:

NodeBuilder.addParameters(S.getContext());

the independent blocks assert ICEs the compiler.

This looks like a bug related to the fact that we perform the analysis of all the scops in the current function before we start generating code for all the scops. The code generation of the first scop invalidates the information for the second scop.

@jdoerfert
Copy link
Member

The bug is reopened and investigated again in 21204.

Tobias will take a look.

*** This bug has been marked as a duplicate of bug llvm/llvm-bugzilla-archive#21204 ***

@tlattner
Copy link
Contributor

Move to Polly Product.

@jdoerfert
Copy link
Member

mentioned in issue llvm/llvm-bugzilla-archive#21204

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla duplicate Resolved as duplicate polly
Projects
None yet
Development

No branches or pull requests

2 participants