This is an archive of the discontinued LLVM Phabricator instance.

[SVE] Remove getNumElements() warnings in InstCombiner::visitBitCast
ClosedPublic

Authored by david-arm on May 26 2020, 8:16 AM.

Details

Summary

Whilst trying to compile this test to assembly:

CodeGen/aarch64-sve-intrinsics/acle_sve_reinterpret.c

I discovered some warnings were firing in InstCombiner::visitBitCast
due to calls to getNumElements() for scalable vector types. These
calls only really made sense for fixed width vectors so I have fixed
up the code appropriately.

Diff Detail

Event Timeline

david-arm created this revision.May 26 2020, 8:16 AM
Herald added a reviewer: efriedma. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
efriedma added inline comments.May 26 2020, 11:35 AM
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
2529

Probably should just be if (auto *DestVTy = dyn_cast<FixedVectorType>(DestTy)) {. A bitcast with a scalable vector dest type must have a scalable vector src type, anyway.

2559

We should have a test that we don't do these folds for scalable vectors.

david-arm marked 2 inline comments as done.May 26 2020, 11:13 PM
david-arm added inline comments.
llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
2529

OK, perhaps you're right. I thought that some of the code below (optimizeIntegerToVectorInsertions) may still kick in for scalable vectors. I'll have a deeper look.

2559

Sure. I hit this while trying to compile a clang ACLE test, so I can reproduce some of that code in a smaller test.

david-arm marked 2 inline comments as done.
This revision is now accepted and ready to land.May 28 2020, 1:42 PM
This revision was automatically updated to reflect the committed changes.