This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] dyn_cast should be dyn_cast_or_null in MASSV pass
ClosedPublic

Authored by masoud.ataei on Nov 18 2020, 11:22 AM.

Details

Summary

It is possible that we have different constants in different slots of a vector double (float).
So, in this case Exp->getSplatValue() will return nullptr.
Here, I am proposing to handle it properly.

Diff Detail

Event Timeline

masoud.ataei created this revision.Nov 18 2020, 11:22 AM
masoud.ataei requested review of this revision.Nov 18 2020, 11:22 AM
steven.zhang added inline comments.Nov 18 2020, 5:12 PM
llvm/lib/Target/PowerPC/PPCLowerMASSVEntries.cpp
108

It seems that some of the test change is not relative with this.(i.e. rename the func name) And the only test change I can imagine is that, some case that we hit ice before now it is passed. That is, if Exp->getSplatValue() return null, dyn_cast will hit ice before. But I didn't see such kind of test.

masoud.ataei added inline comments.Nov 19 2020, 10:14 AM
llvm/lib/Target/PowerPC/PPCLowerMASSVEntries.cpp
108

I agree the rename the func name in the test is irrelevant to this change but the one with

@__powd2_massv(<2 x double> %wide.load, <2 x double> <double 7.700000e-01, double 7.600000e-01>)

and similar ones that tests the two slots of the second vector double has non-equal constants are relevant. For example in this test Exp->getSplatValue() returns nullptr which is handled here.

llvm/test/CodeGen/PowerPC/pow_massv_075_025exp.ll
74

Two slots of the second vector double in __powd2_massv arguments has non-equal constants.

100

Two slots of the second vector double in __powd2_massv arguments has non-equal constants.

126

Two slots of the second vector double in __powd2_massv arguments has non-equal constants.

llvm/test/CodeGen/PowerPC/powf_massv_075_025exp.ll
74

Four slots of the second vector float in __powf4_massv arguments has non-equal constants.

100

Four slots of the second vector float in __powf4_massv arguments has non-equal constants.

126

Four slots of the second vector float in __powf4_massv arguments has non-equal constants.

steven.zhang accepted this revision.Nov 24 2020, 3:30 AM

LGTM as I indeed see the crash fixed.

llvm/test/CodeGen/PowerPC/powf_massv_075_025exp.ll
74

Usually, we will add some comments in the test to indicate that no crash any more.

This revision is now accepted and ready to land.Nov 24 2020, 3:30 AM
This revision was landed with ongoing or failed builds.Nov 24 2020, 8:22 AM
This revision was automatically updated to reflect the committed changes.