HomePhabricator

[AArch64][GlobalISel] Fix a crash during s128 G_ICMP legalization due to…

Description

[AArch64][GlobalISel] Fix a crash during s128 G_ICMP legalization due to r366317.

r366317 added a legalization for s128 G_ICMP narrow scalar which tried to hard
code the result type of the new legalized G_SELECT. Change this to instead use
type of the original G_ICMP result and allow the target to legalize it if necessary
later.

Details

Committed
aemersonWed, Jul 24, 1:46 PM
Parents
rL366942: Let CorrelatedValuePropagation preserve LazyValueInfo
Branches
Unknown
Tags
Unknown

Event Timeline

I thought about this but G_SELECT for aarch64 is only legal for s1 type1 (the condition).
That is why I used s1 for condition in G_SELECT since it is default type and backends can deal with it. maxScalar(1, s1) or D65079 could fix this.

/llvm/trunk/test/CodeGen/AArch64/GlobalISel/legalize-cmp.mir
57

This change avoids assert but breaks G_SELECT, with -global-isel-abort=1 I get
unable to legalize instruction: %4:_(s32) = G_SELECT %10:_(s32), %11:_, %9:_ (in function: test_s128)

I thought about this but G_SELECT for aarch64 is only legal for s1 type1 (the condition).
That is why I used s1 for condition in G_SELECT since it is default type and backends can deal with it. maxScalar(1, s1) or D65079 could fix this.

Thanks, I've used D65079 to fix this in r367060.