Erick Tryzelaar
2009-Aug-18 18:50 UTC
[LLVMdev] gcc4.4's -O2 is breaking include/llvm/CodeGen/ValueTypes.h
I was running into a problem with compiling llvm with gcc 4.4 on fedora 11 with --enable-optimized. I was seeing this warning dozens of times: /net/hakodate/scratch/llvm/llvm/include/llvm/CodeGen/ValueTypes.h: In member function ‘llvm::SDNode*<unnamed>::SPUDAGToDAGISel::Select(llvm::SDValue)’: /net/hakodate/scratch/llvm/llvm/include/llvm/CodeGen/ValueTypes.h:362: warning: comparison always false due to limited range of data type And on "make check" would print out: llc: /scratch/llvm/llvm/include/llvm/CodeGen/ValueTypes.h:231: unsigned int llvm::MVT::getSizeInBits() const: Assertion `0 && "getSizeInBits called on extended MVT."' failed. 0 llc 0x0000000000ee2bef 1 llc 0x0000000000ee488d 2 libpthread.so.0 0x00007f988a8f8e90 3 libc.so.6 0x00007f9889c022f5 gsignal + 53 4 libc.so.6 0x00007f9889c03b20 abort + 384 5 libc.so.6 0x00007f9889bfb2fa __assert_fail + 234 6 llc 0x0000000000640421 llvm::TargetLowering::getTypeToTransformTo(llvm::LLVMContext&, llvm::EVT) const + 977 7 llc 0x0000000000be1aff 8 llc 0x0000000000be6e11 9 llc 0x0000000000badf80 10 llc 0x0000000000bae9d8 llvm::SelectionDAG::LegalizeTypes() + 824 11 llc 0x0000000000b71c14 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 580 12 llc 0x0000000000b73d00 llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*, llvm::ilist_iterator<llvm::Instruction>, llvm::ilist_iterator<llvm::Instruction>) + 96 13 llc 0x0000000000b74103 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function&, llvm::MachineFunction&, llvm::MachineModuleInfo*, llvm::DwarfWriter*, llvm::TargetInstrInfo const&) + 707 14 llc 0x0000000000b75b90 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1024 15 llc 0x0000000000e7715e llvm::FPPassManager::runOnFunction(llvm::Function&) + 574 16 llc 0x0000000000e7737b llvm::FunctionPassManagerImpl::run(llvm::Function&) + 171 17 llc 0x0000000000e775e1 llvm::FunctionPassManager::run(llvm::Function&) + 81 18 llc 0x000000000052418f main + 5247 19 libc.so.6 0x00007f9889beda2d __libc_start_main + 253 20 llc 0x0000000000522129 Stack dump: 0. Program arguments: llc -march=arm 1. Running pass 'ARM Instruction Selection' on function '@_ZL6createP6node_tii3v_tS1_d' The problem appears to be gcc 4.4 optimizing away comparisons of one plus the last item in the SimpleValueType enum, like this: bool operator==(const EVT VT) const { if (V.SimpleTy == VT.V.SimpleTy) { if (V.SimpleTy == MVT::LastSimpleValueType+1) return LLVMTy == VT.LLVMTy; return true; } return false; } I confirmed this by adding a dummy value to the enum that equals LastSimpleValueType+1, and both the warning and the failures in "make check" go away. Is this the right thing to do, or is there a better way to do this?
Dan Gohman
2009-Aug-19 01:46 UTC
[LLVMdev] gcc4.4's -O2 is breaking include/llvm/CodeGen/ValueTypes.h
On Aug 18, 2009, at 11:50 AM, Erick Tryzelaar wrote:> I was running into a problem with compiling llvm with gcc 4.4 on > fedora 11 with --enable-optimized. I was seeing this warning dozens of > times: > > /net/hakodate/scratch/llvm/llvm/include/llvm/CodeGen/ValueTypes.h: In > member function > ‘llvm::SDNode*<unnamed>::SPUDAGToDAGISel::Select(llvm::SDValue)’: > /net/hakodate/scratch/llvm/llvm/include/llvm/CodeGen/ValueTypes.h:362: > warning: comparison always false due to limited range of data type > > And on "make check" would print out: > > llc: /scratch/llvm/llvm/include/llvm/CodeGen/ValueTypes.h:231: > unsigned int llvm::MVT::getSizeInBits() const: Assertion `0 && > "getSizeInBits called on extended MVT."' failed. > 0 llc 0x0000000000ee2bef > 1 llc 0x0000000000ee488d > 2 libpthread.so.0 0x00007f988a8f8e90 > 3 libc.so.6 0x00007f9889c022f5 gsignal + 53 > 4 libc.so.6 0x00007f9889c03b20 abort + 384 > 5 libc.so.6 0x00007f9889bfb2fa __assert_fail + 234 > 6 llc 0x0000000000640421 > llvm::TargetLowering::getTypeToTransformTo(llvm::LLVMContext&, > llvm::EVT) const + 977 > 7 llc 0x0000000000be1aff > 8 llc 0x0000000000be6e11 > 9 llc 0x0000000000badf80 > 10 llc 0x0000000000bae9d8 > llvm::SelectionDAG::LegalizeTypes() + 824 > 11 llc 0x0000000000b71c14 > llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 580 > 12 llc 0x0000000000b73d00 > llvm::SelectionDAGISel::SelectBasicBlock(llvm::BasicBlock*, > llvm::ilist_iterator<llvm::Instruction>, > llvm::ilist_iterator<llvm::Instruction>) + 96 > 13 llc 0x0000000000b74103 > llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function&, > llvm::MachineFunction&, llvm::MachineModuleInfo*, llvm::DwarfWriter*, > llvm::TargetInstrInfo const&) + 707 > 14 llc 0x0000000000b75b90 > llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + > 1024 > 15 llc 0x0000000000e7715e > llvm::FPPassManager::runOnFunction(llvm::Function&) + 574 > 16 llc 0x0000000000e7737b > llvm::FunctionPassManagerImpl::run(llvm::Function&) + 171 > 17 llc 0x0000000000e775e1 > llvm::FunctionPassManager::run(llvm::Function&) + 81 > 18 llc 0x000000000052418f main + 5247 > 19 libc.so.6 0x00007f9889beda2d __libc_start_main + 253 > 20 llc 0x0000000000522129 > Stack dump: > 0. Program arguments: llc -march=arm > 1. Running pass 'ARM Instruction Selection' on function > '@_ZL6createP6node_tii3v_tS1_d' > > > The problem appears to be gcc 4.4 optimizing away comparisons of one > plus the last item in the SimpleValueType enum, like this: > > bool operator==(const EVT VT) const { > if (V.SimpleTy == VT.V.SimpleTy) { > if (V.SimpleTy == MVT::LastSimpleValueType+1) > return LLVMTy == VT.LLVMTy; > return true; > } > return false; > }ValueTypes.h was particularly heavily impacted by the recent API changes, and it looks like it's a bit disheveled at the moment.> > I confirmed this by adding a dummy value to the enum that equals > LastSimpleValueType+1, and both the warning and the failures in "make > check" go away. Is this the right thing to do, or is there a better > way to do this?At some point, someone should take a take a closer look, though the change you propose is fine for now. Dan
Erick Tryzelaar
2009-Aug-19 02:02 UTC
[LLVMdev] gcc4.4's -O2 is breaking include/llvm/CodeGen/ValueTypes.h
On Tue, Aug 18, 2009 at 6:46 PM, Dan Gohman<gohman at apple.com> wrote:> > At some point, someone should take a take a closer look, though > the change you propose is fine for now.Ok, I'll commit it.
Reasonably Related Threads
- [LLVMdev] gcc4.4's -O2 is breaking include/llvm/CodeGen/ValueTypes.h
- [LLVMdev] Porting to System z
- [LLVMdev] 2.5 Pre-release1 available for testing
- [LLVMdev] [Patch] Bufer overrun in getValueTypeList()
- [LLVMdev] a possible alternative for pre-legalize extended ValueTypes