LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1108 - CodeGen/Generic/vector-identity-shuffle.ll regression fails on x86_64
Summary: CodeGen/Generic/vector-identity-shuffle.ll regression fails on x86_64
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: All All
: P normal
Assignee: Evan Cheng
URL:
Keywords: compile-fail
Depends on:
Blocks:
 
Reported: 2007-01-12 12:41 PST by Chandler Carruth
Modified: 2010-02-22 12:45 PST (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chandler Carruth 2007-01-12 12:41:12 PST
On x86_64-pc-linux-gnu the following regression test is failing:

FAIL:
/home/chandlerc/code/compilers/llvm/test/Regression/CodeGen/Generic/vector-identity-shuffle.ll:

child process exited abnormally
test:
llc:
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1143:
llvm::SDOperand llvm::SelectionDAG::getNode(unsigned int, llvm::MVT::ValueType,
llvm::SDOperand): Assertion `MVT::isVector(VT) &&
!MVT::isVector(Operand.getValueType()) && MVT::getVectorBaseType(VT) ==
Operand.getValueType() && "Illegal SCALAR_TO_VECTOR node!"' failed.


When run by hand in GDB, I get the following backtrace:

gdb> set args vector-identity-shuffle.bc
gdb> run
[Thread debugging using libthread_db enabled]
[New Thread 47416736631584 (LWP 7527)]
llc:
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1143:
llvm::SDOperand llvm::SelectionDAG::getNode(unsigned int, llvm::MVT::ValueType,
llvm::SDOperand): Assertion `MVT::isVector(VT) &&
!MVT::isVector(Operand.getValueType()) && MVT::getVectorBaseType(VT) ==
Operand.getValueType() && "Illegal SCALAR_TO_VECTOR node!"' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 47416736631584 (LWP 7527)]
_______________________________________________________________________________
Error while running hook_stop:
Value can't be converted to integer.
0x00002b20119d97b5 in raise () from /lib/libc.so.6
gdb> bt
#0  0x00002b20119d97b5 in raise () from /lib/libc.so.6
#1  0x00002b20119daa4e in abort () from /lib/libc.so.6
#2  0x00002b20119d3156 in __assert_fail () from /lib/libc.so.6
#3  0x0000000000a195e1 in llvm::SelectionDAG::getNode (this=0x7fff999a3f90,
Opcode=0x47, VT=llvm::MVT::v4i32, Operand={Val = 0x104cda0, ResNo = 0x0}) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1141
#4  0x00000000008ce63e in llvm::X86TargetLowering::LowerBUILD_VECTOR
(this=0x1046400, Op={Val = 0x104e380, ResNo = 0x0}, DAG=@0x7fff999a3f90) at
/home/chandlerc/code/compilers/llvm/lib/Target/X86/X86ISelLowering.cpp:3407
#5  0x00000000008e2916 in llvm::X86TargetLowering::LowerOperation
(this=0x1046400, Op={Val = 0x104e380, ResNo = 0x0}, DAG=@0x7fff999a3f90) at
/home/chandlerc/code/compilers/llvm/lib/Target/X86/X86ISelLowering.cpp:5020
#6  0x0000000000a6aca7 in (anonymous
namespace)::SelectionDAGLegalize::LegalizeOp (this=0x7fff999a3c80, Op={Val =
0x104e380, ResNo = 0x0}) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:901
#7  0x0000000000a83890 in (anonymous
namespace)::SelectionDAGLegalize::PackVectorOp (this=0x7fff999a3c80, Op={Val =
0x104dee0, ResNo = 0x0}, NewVT=llvm::MVT::v4i32) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:5523
#8  0x0000000000a971e4 in (anonymous namespace)::SelectionDAGLegalize::HandleOp
(this=0x7fff999a3c80, Op={Val = 0x104dee0, ResNo = 0x0}) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:476
#9  0x0000000000a97708 in (anonymous
namespace)::SelectionDAGLegalize::LegalizeDAG (this=0x7fff999a3c80) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:340
#10 0x0000000000a9788d in llvm::SelectionDAG::Legalize (this=0x7fff999a3f90) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:5537
#11 0x0000000000a28a87 in llvm::SelectionDAGISel::CodeGenAndEmitDAG
(this=0x1046350, DAG=@0x7fff999a3f90) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:4110
#12 0x0000000000a3c8ee in llvm::SelectionDAGISel::SelectBasicBlock
(this=0x1046350, LLVMBB=0x1040880, MF=@0x104c250, FuncInfo=@0x7fff999a4210) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:4140
#13 0x0000000000a3d699 in llvm::SelectionDAGISel::runOnFunction (this=0x1046350,
Fn=@0x103c230) at
/home/chandlerc/code/compilers/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:3842
#14 0x00000000008f320b in (anonymous namespace)::X86DAGToDAGISel::runOnFunction
(this=0x1046350, Fn=@0x103c230) at
/home/chandlerc/code/compilers/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:121
#15 0x0000000000c2d106 in llvm::FPPassManager::runOnFunction (this=0x1045420,
F=@0x103c230) at /home/chandlerc/code/compilers/llvm/lib/VMCore/PassManager.cpp:1252
#16 0x0000000000c2d338 in llvm::FunctionPassManagerImpl::run (this=0x1044c60,
F=@0x103c230) at /home/chandlerc/code/compilers/llvm/lib/VMCore/PassManager.cpp:1218
#17 0x0000000000c2d3fb in llvm::FunctionPassManager::run (this=0x7fff999a45d0,
F=@0x103c230) at /home/chandlerc/code/compilers/llvm/lib/VMCore/PassManager.cpp:1163
#18 0x00000000007d13dc in main (argc=0x2, argv=0x7fff999a47b8) at
/home/chandlerc/code/compilers/llvm/tools/llc/llc.cpp:264


Is there any other information I can get that would help? Currently its the only
(non-debuginfo) test failing.
Comment 1 Chris Lattner 2007-01-13 13:30:06 PST
This also fails on x86-64 darwin.  To reproduce:

$ llvm-upgrade < vector-identity-shuffle.ll | llvm-as | llc -march=x86-64
SelectionDAG.cpp:1143: failed assertion `MVT::isVector(VT) && !MVT::isVector(Operand.getValueType()) 
&& MVT::getVectorBaseType(VT) == Operand.getValueType() && "Illegal SCALAR_TO_VECTOR node!"'
Abort

Evan, can you take a look at this?

-Chris
Comment 2 Evan Cheng 2007-01-18 20:08:57 PST
DAG combiner is turning a vbuild_vector of a bunch of vextract_vector_elt into a
vbuild_vector. It assumes element type is i32. However the vextract_vector_elt
uses pointerTy() for the index operand.

Seems to me at the llvm level, i32 is the index type. The fix should be to
change selectiondagisel and legalizer, etc. to use i32 instead iptr. Chris, do
you agree?
Comment 3 Chris Lattner 2007-01-19 12:47:13 PST
I'm not sure that will work Evan.  What happens if i32 isn't a legal type?  My
memory is fuzzy, but I think the reason it uses iPTR is that it assumes pointers
are a legal type that won't themselves be expanded or promoted. 
Comment 4 Evan Cheng 2007-01-20 04:25:53 PST
Ok. Fixed DAGCombiner to use iPtr instead.

My concern with this fix is even though i64 is a legal type, v4i64 isn't. If DAG
combiner creates a VBUILD_VECTOR with 4 i64 elements (as it does here), would it
cause some troubles downstream?

Fix appears to work for now.
Comment 5 Chris Lattner 2007-01-20 14:30:18 PST
Thanks Evan!  Please include a link to the patch and the path to the testcase in this bug, for future 
reference.

-Chris