This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Remove assert from SelectionDAG::getZeroExtendInReg
Needs ReviewPublic

Authored by paquette on Jun 23 2020, 11:29 AM.

Details

Summary

Remove the assert from SelectionDAG::getZeroExtendInReg which checks that OpVT.isVector() == VT.isVector().

This assert was added in c41685b16fcceaa2078eb14eb27f6696f851eb49. This did some refactoring to reduce the number of calls to getScalarType.

If you're building stuff for arm64_32, it's possible to break this assumption.

E.g. in SelectionDAGBuilder::visitGetElementPtr:

MVT PtrTy = TLI.getPointerTy(DAG.getDataLayout(), AS);
MVT PtrMemTy = TLI.getPointerMemTy(DAG.getDataLayout(), AS);
...
if (PtrMemTy != PtrTy && !cast<GEPOperator>(I).isInBounds())
  N = DAG.getPtrExtendInReg(N, dl, PtrMemTy);

All getPtrExtendInReg does is return getZeroExtendInReg. So, if N is a vector, we'll hit the assert.

Add a testcase to arm64_32-pointer-extend.ll that shows an example of this.

Diff Detail

Event Timeline

paquette created this revision.Jun 23 2020, 11:29 AM
Herald added a project: Restricted Project. · View Herald Transcript
craig.topper added inline comments.Jun 23 2020, 7:33 PM
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
1177

This bitLE check doesn't check what its intending to check if VT is a scalar and OpVT is a vector. Should probably check the bits of the scalar type.