shiltian wrote: After taking the advices, the code generated from GlobalISel was not changed for the case above. Need to figure out where they come from, especially the compare instruction. https://github.com/llvm/llvm-project/pull/83155