This is an archive of the discontinued LLVM Phabricator instance.

Clean up usages of asserting vector getters in Type
ClosedPublic

Authored by ctetreau on Apr 1 2020, 5:05 PM.

Details

Summary

Remove usages of asserting vector getters in Type in preparation for the
VectorType refactor. The existence of these functions complicates the
refactor while adding little value.

Diff Detail

Event Timeline

ctetreau created this revision.Apr 1 2020, 5:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptApr 1 2020, 5:05 PM
efriedma added inline comments.Apr 3 2020, 2:18 PM
llvm/lib/IR/ConstantFold.cpp
2010

Please split out.

llvm/lib/IR/Constants.cpp
320

Please split this off into a separate patch.

I think "return false" is actually correct, but it probably makes sense to assert the vector is a ConstantAggregateZero or an UndefValue.

llvm/lib/IR/Function.cpp
1067

Does VectorType::getNumElements() not return unsigned?

llvm/lib/IR/Verifier.cpp
4682

Please don't mix functional and non-functional changes.

ctetreau marked an inline comment as done.Apr 3 2020, 4:40 PM
ctetreau added inline comments.
llvm/lib/IR/Function.cpp
1067

it's uint64_t. getVectorNumElements() was unsigned, it just did the conversion

ctetreau marked 3 inline comments as done.Apr 3 2020, 4:51 PM
ctetreau updated this revision to Diff 254964.Apr 3 2020, 5:20 PM

Address code review issues

efriedma added inline comments.Apr 3 2020, 5:35 PM
llvm/lib/IR/Constants.cpp
1894

Please don't mix functional and non-functional changes.

1908

Please don't mix functional and non-functional changes.

llvm/lib/IR/Instructions.cpp
2953

Please don't mix functional and non-functional changes.

2972

Please don't mix functional and non-functional changes.

llvm/lib/IR/Verifier.cpp
2830

Please don't mix functional and non-functional changes.

3348

Please don't mix functional and non-functional changes.

4663

Please don't mix functional and non-functional changes.

ctetreau updated this revision to Diff 255467.Apr 6 2020, 1:26 PM

Address code review issues

ctetreau updated this revision to Diff 255476.Apr 6 2020, 1:39 PM

missed one code review issue

efriedma added inline comments.Apr 6 2020, 1:51 PM
llvm/lib/IR/Constants.cpp
231

Please don't add new isScalable checks in this patch. (Here, and other places in this file.)

ctetreau updated this revision to Diff 255811.Apr 7 2020, 2:18 PM

address code review issues

efriedma added inline comments.Apr 7 2020, 4:05 PM
llvm/lib/IR/ConstantFold.cpp
757

ConstantFoldSelectInstruction can take non-vector inputs. This should cause test failures. (Somehow I thought you fixed this in an earlier revision, but I could be mistaken.)

ctetreau marked an inline comment as done.Apr 8 2020, 3:57 PM
ctetreau added inline comments.
llvm/lib/IR/ConstantFold.cpp
757

I'll fix it

ctetreau marked an inline comment as done.Apr 8 2020, 4:44 PM
ctetreau added inline comments.
llvm/lib/IR/Function.cpp
1067

I added D77763 to change it. Most of the calls to this were through getVectorNumElements() anyways, which did the cast.

ctetreau updated this revision to Diff 256401.Apr 9 2020, 2:01 PM

address code review issues

efriedma added inline comments.Apr 9 2020, 8:54 PM
llvm/lib/IR/ConstantFold.cpp
761

Unnecessary cast<>

ctetreau updated this revision to Diff 256583.Apr 10 2020, 8:53 AM

address code review issues

This revision is now accepted and ready to land.Apr 10 2020, 11:15 AM
This revision was automatically updated to reflect the committed changes.