[LoongArch] Override TargetLowering::isShuffleMaskLegal
commit66a3e4fafb6eae19764f8a192ca3a116c0554211
authorwanglei <wanglei@loongson.cn>
Sat, 2 Dec 2023 06:25:17 +0000 (2 14:25 +0800)
committerwanglei <wanglei@loongson.cn>
Sat, 2 Dec 2023 06:25:17 +0000 (2 14:25 +0800)
treee14a2e66ca858d068503ee978ae3ce6b36e183d5
parent19e068b048591feb8fa66b164669c753090dfd3a
[LoongArch] Override TargetLowering::isShuffleMaskLegal

 By default, `isShuffleMaskLegal` always returns true, which can result
 in the expansion of `BUILD_VECTOR` into a `VECTOR_SHUFFLE` node in
 certain situations. Subsequently, the `VECTOR_SHUFFLE` node is expanded
 again into a `BUILD_VECTOR`, leading to an infinite loop.
 To address this, we always return false, allowing the expansion of
 `BUILD_VECTOR` through the stack.
llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
llvm/lib/Target/LoongArch/LoongArchISelLowering.h
llvm/test/CodeGen/LoongArch/lsx/build-vector.ll