Combine zext(trunc x) to x when truncated bits are known to be zero.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
Maybe should add a vector test, although known bits vector support may be too weak to test it
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
2312 | getScalarSizeInBits |
Comment Actions
Looks good but I think it needs more test coverage. Does it work on vector types? (You might need to use getScalarSizeInBits instead of getSizeInBits?) If it does work on vectors then that needs tests.
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | ||
---|---|---|
2310 | Maybe add a test case to check that this combine does nothing if the inner and outer types don't match? |
Comment Actions
LGTM.
llvm/test/CodeGen/AMDGPU/GlobalISel/combine-zext-trunc.mir | ||
---|---|---|
60–61 | In this case you could just use a trunc from s64 to s32. No need for the zext. That could be a follow-up though. |
Maybe add a test case to check that this combine does nothing if the inner and outer types don't match?