[LLVMbugs] [Bug 10422] New: x86/AVX codegen crashes on fcmp + br + call instruction combination.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 20 04:38:30 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10422

           Summary: x86/AVX codegen crashes on fcmp + br + call
                    instruction combination.
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            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


Created an attachment (id=6911)
 --> (http://llvm.org/bugs/attachment.cgi?id=6911)
C program to reproduce the bug.

Rev: 135566

With attached main.c, in combination of AVX and optimization(-O2), 

$ clang -mavx -O2 main.c 

crashes as follows.

syoyo at syoyo-desktop:~/work/llvm-bugs$ clang -mavx -O2 main.c 
clang: /home/syoyo/work/llvm-git/include/llvm/CodeGen/MachineInstr.h:210:
llvm::MachineOperand& llvm::MachineInstr::getOperand(unsigned int): Assertion
`i < getNumOperands() && "getOperand() out of range!"' failed.
0  clang           0x0000000001af5c8f
1  clang           0x0000000001af7f02
2  libpthread.so.0 0x00007f1e7078f8f0
3  libc.so.6       0x00007f1e6fa7ea75 gsignal + 53
4  libc.so.6       0x00007f1e6fa825c0 abort + 384
5  libc.so.6       0x00007f1e6fa77941 __assert_fail + 241
6  clang           0x00000000010ec364
7  clang           0x000000000143e90e
llvm::X86InstrInfo::foldMemoryOperandImpl(llvm::MachineFunction&,
llvm::MachineInstr*, llvm::SmallVectorImpl<unsigned int> const&,
llvm::MachineInstr*) const + 414
8  clang           0x000000000170fd2a
llvm::TargetInstrInfo::foldMemoryOperand(llvm::ilist_iterator<llvm::MachineInstr>,
llvm::SmallVectorImpl<unsigned int> const&, llvm::MachineInstr*) const + 218
9  clang           0x0000000001757334
10 clang           0x000000000175ce9f
11 clang           0x000000000175db88
12 clang           0x00000000016a9f68
13 clang           0x000000000179b9f3 llvm::RegAllocBase::allocatePhysRegs() +
611
14 clang           0x00000000016a72a1
15 clang           0x0000000001a481db
llvm::FPPassManager::runOnFunction(llvm::Function&) + 587
16 clang           0x0000000001a482db
llvm::FPPassManager::runOnModule(llvm::Module&) + 75
17 clang           0x0000000001a47ce1
llvm::MPPassManager::runOnModule(llvm::Module&) + 497
18 clang           0x0000000001a47e6b llvm::PassManagerImpl::run(llvm::Module&)
+ 187
19 clang           0x00000000007d1e65
clang::EmitBackendOutput(clang::Diagnostic&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::Module*,
clang::BackendAction, llvm::raw_ostream*) + 1989
20 clang           0x00000000007cf20e
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) + 270
21 clang           0x0000000000912eef clang::ParseAST(clang::Sema&, bool) + 431
22 clang           0x00000000007ce434 clang::CodeGenAction::ExecuteAction() +
68
23 clang           0x00000000006af8a3
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 371
24 clang           0x00000000006961ee
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1326
25 clang           0x000000000068bd48 cc1_main(char const**, char const**, char
const*, void*) + 1000
26 clang           0x000000000069503b main + 7131
27 libc.so.6       0x00007f1e6fa69c4d __libc_start_main + 253
28 clang           0x000000000068ae39
Stack dump:
0.    Program arguments: /home/syoyo/work/llvm-git/Release+Asserts/bin/clang
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name
main.c -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature +avx
-target-linker-version 2.20.1 -momit-leaf-frame-pointer -resource-dir
/home/syoyo/work/llvm-git/Release+Asserts/bin/../lib/clang/3.0 -O2
-ferror-limit 19 -fmessage-length 119 -fdiagnostics-show-option
-fcolor-diagnostics -o /tmp/cc-5yEmeX.o -x c main.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'main.c'.
4.    Running pass 'Greedy Register Allocator' on function '@render'
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 2 (use -v to see
invocation)


---------------------------

Here's simplified IR reduced by bugpoint.

$ cat bugpoint-reduced-simplified.ll 
; ModuleID = 'bugpoint-reduced-simplified.bc'
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
target triple = "x86_64-unknown-linux-gnu"

declare void @scale() nounwind uwtable

define void @render() nounwind uwtable {
entry:
  br i1 undef, label %for.cond5, label %for.end52

for.cond5:                                        ; preds = %for.cond30,
%for.cond5, %entry
  %or.cond = and i1 undef, false
  br i1 %or.cond, label %for.body33, label %for.cond5

for.cond30:                                       ; preds = %if.then,
%for.body33
  br i1 false, label %for.body33, label %for.cond5

for.body33:                                       ; preds = %for.cond30,
%for.cond5
  %tobool = fcmp une double undef, 0.000000e+00
  br i1 %tobool, label %if.then, label %for.cond30

if.then:                                          ; preds = %for.body33
  call void @scale()
  br label %for.cond30

for.end52:                                        ; preds = %entry
  ret void
}

-- 
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