If the load is already an extended load we should be using the memory VT for the legality check, not just the VT of the current extension.
I don't have a test case, just noticed it while investigating some load extension improvements.
Differential D42783
[DAGCombiner] When folding fold (sext/zext (and/or/xor (sextload/zextload x), cst)) -> (and/or/xor (sextload/zextload x), (sext/zext cst)) make sure we check the legality of the full extended load. craig.topper on Jan 31 2018, 11:04 PM. Authored by
Details If the load is already an extended load we should be using the memory VT for the legality check, not just the VT of the current extension. I don't have a test case, just noticed it while investigating some load extension improvements.
Diff Detail
Event TimelineComment Actions Maybe? I'm still trying to get my head around this code. There are some other issues we need to investigate here first. We don't call ExtendUsesToFormExtLoad when the load itself has multiple uses. Just when the AND/OR/XOR has multiple uses, but we're passing the SDValue of the load. So we'll only collect setccs when the and/or/xor has additional users and the load is used by more than just the and/or/xor. Comment Actions The other consequence of that is that any additional users of the load aren't checked for the isTruncateFree in ExtendUsesToFormExtLoad. So the test case I regressed in D42679 only works today by accident because we didn't check the additional load user which was a truncate. |