aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2018-02-06 23:54:37 +0000
committerCraig Topper <craig.topper@intel.com>2018-02-06 23:54:37 +0000
commit58ecffd857a9f998904b8b6d69348cbe5fa85c47 (patch)
tree155a2878a7ea91dd1e68a534698dabb876939203 /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
parent8c59921ca3284ced1c358c4c86ec2c830db0bd70 (diff)
downloadllvm-58ecffd857a9f998904b8b6d69348cbe5fa85c47.zip
llvm-58ecffd857a9f998904b8b6d69348cbe5fa85c47.tar.gz
llvm-58ecffd857a9f998904b8b6d69348cbe5fa85c47.tar.bz2
[DAGCombiner][AMDGPU][X86] Turn cttz/ctlz into cttz_zero_undef/ctlz_zero_undef if we can prove the input is never zero
X86 currently has a late DAG combine after cttz/ctlz are turned into BSR+BSF+CMOV to detect this and remove the CMOV. But we should be able to do this much earlier and avoid creating the cmov all together. For the changed AMDGPU test case it appears that previously the i8 cttz was type legalized to i16 which introduced an OR with 256 in order to limit the result to 8 on the widened type. At this point the result is known to never be zero, but nothing checked that. Then operation legalization is told to promote all i16 cttz to i32. This introduces an extend and a truncate and another OR with 65536 to limit the result to 16. With the DAG combiner change we are able to prevent the creation of the second OR since the opcode will have been changed to cttz_zero_undef after the first OR. I the lack of the OR caused the instruction to change to v_ffbl_b32_sdwa Differential Revision: https://reviews.llvm.org/D42985 llvm-svn: 324427
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions