[TypePromotion] Refine fix sext/zext for promoted constant from D125294.
authorCraig Topper <craig.topper@sifive.com>
Sat, 21 May 2022 21:02:22 +0000 (14:02 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sat, 21 May 2022 21:08:15 +0000 (14:08 -0700)
commit4638766794b0d9e9a9262e59e3a5cccde657b2ef
tree9e1579f705e5263cc82c5f1b08eac67f36a913b3
parent55e8f721d4d0996cbe5dc802a2c5fbe48dac0d44
[TypePromotion] Refine fix sext/zext for promoted constant from D125294.

Reviewing the code again, I believe the sext is needed on the LHS
or RHS for ICmp and only on the RHS for Add.

Add an opcode check before checking the operand number.

Fixes PR55627.

Differential Revision: https://reviews.llvm.org/D125654
llvm/lib/CodeGen/TypePromotion.cpp
llvm/test/Transforms/TypePromotion/ARM/icmps.ll