[LLVMbugs] [Bug 10941] New: [AVX] foldMemoryOperand failed for bezier code example.
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Sep 16 09:10:06 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10941
Summary: [AVX] foldMemoryOperand failed for bezier code
example.
Product: libraries
Version: trunk
Platform: PC
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Backend: X86
AssignedTo: unassignedbugs at nondot.org
ReportedBy: syoyofujita at gmail.com
CC: llvmbugs at cs.uiuc.edu
revision: 139901
x86/AVX codegen with the optimization failed for following bezier calculation
code.
$ cat bezier.cpp
#include <cassert>
#include <cstring>
static const int BINOMIAL_TABLE[12][12] = {
{1}, /*0*/
{1,1}, /*1*/
{1,2,1}, /*2*/
{1,3,3,1}, /*3*/
{1,4,6,4,1}, /*4*/
{1,5,10,10,5,1}, /*5*/
{1,6,15,20,15,6,1}, /*6*/
{1,7,21,35,35,21,7,1}, /*7*/
{1,8,28,56,70,56,28,8,1}, /*8*/
{1,9,36,84,126,126,84,36,9,1}, /*9*/
{1,10,45,120,210,252,210,120,45,10,1}, /*10*/
{1,11,55,165,330,462,462,330,165,55,11,1}, /*11*/
};
static
int binomial(int i, int j)
{
assert(0<=i);
assert(0<=j && j<=i);
if(i<=11){
return BINOMIAL_TABLE[i][j];
}else{
if(j==0||j==i){
return 1;
}else{
return binomial(i-1,j-1)+binomial(i-1,j);
}
}
}
static
int sgn(int i, int j)
{
return ((i+j)&1)?1:-1;
}
static
void bernstein_deriv_n(float t, float e[], int n){
memset(e,0,sizeof(float)*n);//ZERO
float s = 1;
for(int i = n-2;0<=i;i--){//
int k = n-i;//
for(int j = 0;j<k;j++){
e[j] += sgn(i,j)*binomial(n-1-j,i)*s*(n-1-i);
}
s *= t;
}
for(int i = 0;i<n;i++){
e[i] *= (float)(binomial(n-1,i));
}
}
void bernstein_deriv(float t, float e[], int n){
bernstein_deriv_n(t, e, n);
}
$ clang++ -mavx -O3 bezier.cpp
Assertion failed: ((!(Flags & MachineMemOperand::MOLoad) ||
NewMI->getDesc().mayLoad()) && "Folded a use to a non-load!"), function
foldMemoryOperand, file TargetInstrInfoImpl.cpp, line 295.
0 clang 0x0000000101a46432 PrintStackTrace(void*) + 34
1 clang 0x0000000101a47283 SignalHandler(int) + 707
2 libSystem.B.dylib 0x00007fff849061ba _sigtramp + 26
3 libSystem.B.dylib 0x00000001031d0330 _sigtramp + 2123145616
4 clang 0x000000010001dd02 __assert_rtn + 66
5 clang 0x00000001015fe7de
llvm::TargetInstrInfo::foldMemoryOperand(llvm::ilist_iterator<llvm::MachineInstr>,
llvm::SmallVectorImpl<unsigned int> const&, int) const + 894
6 clang 0x000000010148f2da (anonymous
namespace)::InlineSpiller::foldMemoryOperand(llvm::ilist_iterator<llvm::MachineInstr>,
llvm::SmallVectorImpl<unsigned int> const&, llvm::MachineInstr*) + 1354
7 clang 0x0000000101495868 (anonymous
namespace)::InlineSpiller::spillAroundUses(unsigned int) + 1432
8 clang 0x0000000101497754 (anonymous
namespace)::InlineSpiller::spillAll() + 420
9 clang 0x000000010149823f (anonymous
namespace)::InlineSpiller::spill(llvm::LiveRangeEdit&) + 1135
10 clang 0x000000010156da0b (anonymous
namespace)::RAGreedy::selectOrSplit(llvm::LiveInterval&,
llvm::SmallVectorImpl<llvm::LiveInterval*>&) + 763
11 clang 0x00000001015566db llvm::RegAllocBase::allocatePhysRegs()
+ 331
12 clang 0x00000001015689ee (anonymous
namespace)::RAGreedy::runOnMachineFunction(llvm::MachineFunction&) + 1390
13 clang 0x0000000101502373
llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 83
14 clang 0x000000010197ab40
llvm::FPPassManager::runOnFunction(llvm::Function&) + 752
15 clang 0x000000010197ac6b
llvm::FPPassManager::runOnModule(llvm::Module&) + 187
16 clang 0x000000010197a41f
llvm::MPPassManager::runOnModule(llvm::Module&) + 607
17 clang 0x000000010197a721
llvm::PassManagerImpl::run(llvm::Module&) + 177
18 clang 0x000000010197a83d llvm::PassManager::run(llvm::Module&) +
13
19 clang 0x00000001001bbc8e
clang::EmitBackendOutput(clang::Diagnostic&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 1358
20 clang 0x000000010030cec6
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 294
21 clang 0x0000000100342124 clang::ParseAST(clang::Sema&, bool) +
452
22 clang 0x000000010030ba6c clang::CodeGenAction::ExecuteAction() +
60
23 clang 0x0000000100049863
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 435
24 clang 0x0000000100028df5
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1733
25 clang 0x000000010001fbb2 cc1_main(char const**, char const**,
char const*, void*) + 658
26 clang 0x0000000100027b3e main + 4542
27 clang 0x000000010001e454 start + 52
28 clang 0x000000000000002b start + 4294843403
Stack dump:
0. Program arguments: /Users/syoyo/work/llvm/Release+Asserts/bin/clang -cc1
-triple x86_64-apple-macosx10.6.8 -emit-obj -disable-free -main-file-name
bezier.cpp -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables
-target-cpu core2 -target-feature +avx -target-linker-version 97.17
-coverage-file bezier.o -resource-dir
/Users/syoyo/work/llvm/Release+Asserts/bin/../lib/clang/3.0 -fmodule-cache-path
/var/folders/6g/6gpoHXNrH8ygI21qZX4ceU+++TI/-Tmp-/clang-module-cache -O3
-fdeprecated-macro -ferror-limit 19 -fmessage-length 141 -stack-protector 1
-fblocks -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o bezier.o -x c++ bezier.cpp
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'bezier.cpp'.
4. Running pass 'Greedy Register Allocator' on function
'@_Z15bernstein_derivfPfi'
clang: error: unable to execute command: Illegal instruction
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Preprocessed source(s) are located at:
clang: note: diagnostic msg:
/var/folders/6g/6gpoHXNrH8ygI21qZX4ceU+++TI/-Tmp-/bezier-r34N2d.ii
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list