-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 9267 |
| Resolution | FIXED |
| Resolved on | Feb 20, 2011 07:39 |
| Version | trunk |
| OS | Windows NT |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
According to the LangRef, vector Zext are not supported by the spec. However, we would like to enable them. Currently, most vector zext instructions would crash the codegen in various places. For example:
llc: XXX/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3914: llvm::SDValue llvm::SelectionDAG::getLoad(llvm::ISD::MemIndexedMode, llvm::ISD::LoadExtType, llvm::EVT, llvm::DebugLoc, llvm::SDValue, llvm::SDValue, llvm::SDValue, llvm::EVT, llvm::MachineMemOperand*): Assertion `VT.isVector() == MemVT.isVector() && "Cannot use trunc store to convert to or from a vector!"' failed.
vector zext is properly expanded to any_extend, except for cases where it is combined with the load operation. The problem is with the DAGcombining pass. In the first round, where it is okay to create illegal types and operations, it creates a complex-zext load. The problem is that there is no legalizer to legalize the newly load in the following stages.
Here is a patch against 2.8. It works on a bunch of test cases that I generated.
Index: DAGCombiner.cpp
--- DAGCombiner.cpp (revision XXX)
+++ DAGCombiner.cpp (working copy)
@@ -3685,8 +3685,7 @@
// fold (zext (load x)) -> (zext (truncate (zextload x)))
if (ISD::isNON_EXTLoad(N0.getNode()) &&
-
((!LegalOperations && !cast<LoadSDNode>(N0)->isVolatile()) || -
TLI.isLoadExtLegal(ISD::ZEXTLOAD, N0.getValueType()))) {
-
bool DoXform = true;
(TLI.isLoadExtLegal(ISD::ZEXTLOAD, N0.getValueType()))) {
SmallVector<SDNode*, 4> SetCCs;
if (!N0.hasOneUse())