[polly][vectorizer] do not emit bitcast i32** to <1 x i32*>*

Sebastian Pop spop at codeaurora.org
Tue Oct 15 09:33:50 PDT 2013


Hi Tobi,

Sebastian Pop wrote:
> Tobias Grosser wrote:
> > 1) Bitcast patch
> > 
> > The patch goes definitely in the right direction. However, it would
> > be nice if you could besides modifying the existing test cases also
> > provide a test cases that fail without these changes.
> 
> I will reduce a testcase and repost the patch for review.

Here is a C reduced testcase: (thanks to http://embed.cs.utah.edu/creduce/ )

$ cat block.c
typedef struct {
  short mpr[0];
} P;
P *a;
int b[4];
void fn1() {
  int i;
  for (i = 0; i < 4; i++)
    b[i] = a->mpr[0];
}

$ clang -cc1 -O3 -load LLVMPolly.so -mllvm -polly -mllvm -polly-vectorizer=polly -S block.c
clang: lib/IR/Instructions.cpp:2929: llvm::BitCastInst::BitCastInst(llvm::Value *, llvm::Type *, const llvm::Twine &, llvm::Instruction *): Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed.
0  clang           0x0000000002ef31be llvm::sys::PrintStackTrace(_IO_FILE*) + 46
1  clang           0x0000000002ef347b
2  clang           0x0000000002ef36ee
3  libpthread.so.0 0x00007fbb2035d8f0
4  libc.so.6       0x00007fbb1f527a75 gsignal + 53
5  libc.so.6       0x00007fbb1f52b5c0 abort + 384
6  libc.so.6       0x00007fbb1f520941 __assert_fail + 241
7  clang           0x0000000002e3718e llvm::BitCastInst::BitCastInst(llvm::Value*, llvm::Type*, llvm::Twine const&, llvm::Instruction*) + 174
8  clang           0x00000000029fb0ce
9  clang           0x00000000029fa8ac
10 clang           0x00000000029a8448
11 clang           0x00000000029a7bfb
12 clang           0x00000000029a423b
13 clang           0x00000000029a511d
14 clang           0x0000000002e5dcdb llvm::FPPassManager::runOnFunction(llvm::Function&) + 427
15 clang           0x0000000002e5dfe8 llvm::FPPassManager::runOnModule(llvm::Module&) + 104
16 clang           0x0000000002e5e3ea llvm::MPPassManager::runOnModule(llvm::Module&) + 634
17 clang           0x0000000002e5eb9e llvm::PassManagerImpl::run(llvm::Module&) + 302
18 clang           0x0000000002e5edf1 llvm::PassManager::run(llvm::Module&) + 33
19 clang           0x0000000000acc79b
20 clang           0x0000000000acc318 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) + 104
21 clang           0x0000000000ac9389
22 clang           0x0000000000d1f8ad clang::ParseAST(clang::Sema&, bool, bool) + 813
23 clang           0x000000000080a769 clang::ASTFrontendAction::ExecuteAction() + 345
24 clang           0x0000000000ac86ce clang::CodeGenAction::ExecuteAction() + 1246
25 clang           0x000000000080a28f clang::FrontendAction::Execute() + 191
26 clang           0x00000000007d6060 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 800
27 clang           0x0000000000799298 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1048
28 clang           0x000000000078765a cc1_main(char const**, char const**, char const*, void*) + 698
29 clang           0x00000000007935c2 main + 578
30 libc.so.6       0x00007fbb1f512c4d __libc_start_main + 253
31 clang           0x00000000007872d9
Stack dump:
0.	Program arguments: clang -cc1 -O3 -load LLVMPolly.so -mllvm -polly -mllvm -polly-vectorizer=polly -S block.c 
1.	<eof> parser at end of file
2.	Per-module optimization passes
3.	Running pass 'Function Pass Manager' on module 'block.c'.
4.	Running pass 'Combine redundant instructions' on function '@fn1'

I was not able to write a Polly specific testcase that would fail with opt.
Tobi, can you help extracting a testcase?

Also wondering, is there a way to add C testcases to Polly?

Thanks,
Sebastian
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation



More information about the llvm-commits mailing list