This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Fixed select + masked load fold failure
ClosedPublic

Authored by DylanFleming-arm on Aug 3 2021, 10:01 AM.

Details

Summary

Fixed type assertion failure caused by trying to fold a masked load with a
select where the select condition is a scalar value

Diff Detail

Event Timeline

DylanFleming-arm requested review of this revision.Aug 3 2021, 10:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 3 2021, 10:01 AM
sdesmalen accepted this revision.Aug 3 2021, 10:09 AM

LGTM

llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
3234

nit: unnecessary parentheses

This revision is now accepted and ready to land.Aug 3 2021, 10:09 AM
lebedev.ri accepted this revision.Aug 3 2021, 10:12 AM
lebedev.ri added a subscriber: lebedev.ri.

LG

srj added a comment.Aug 3 2021, 10:21 AM

I can confirm that this fixes the known issue in Halide. Thanks!

srj added a comment.Aug 3 2021, 10:31 AM

(I presume this will be backported to the release/13.x branch as well as main?)

Yeah, I think it definitely makes sense to have it put into the LLVM13 release

paulwalker-arm added inline comments.
llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
3234

Not a big issue but looking at the definition of select I think this can just be isa<VectorType>(CondVal->getType) and having that first in the if's condition block would prevent unnecessary calls to match and thus improve compile time by the odd nanosecond.