[X86] Prevent constant hoisting for a couple compare immediates that the selection...
authorCraig Topper <craig.topper@gmail.com>
Sun, 20 Dec 2015 18:41:54 +0000 (18:41 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 20 Dec 2015 18:41:54 +0000 (18:41 +0000)
commit074e845260f2e1d4f98d3e20215ece11af02cae0
tree492e32840113b787794f89b2ceed0e029e71cb0c
parent30e2307f61b5e0e26c6b5c72dc2ea6b56f5ddad0
[X86] Prevent constant hoisting for a couple compare immediates that the selection DAG knows how to optimize into a shift.

This allows "icmp ugt %a, 4294967295" and "icmp uge %a, 4294967296" to be optimized into right shifts by 32 which can fold the immediate into the shift instruction. These patterns show up with some regularity in real code.

Unfortunately, since getImmCost can't see the icmp predicate we can't be tell if we're only catching these specific cases.

llvm-svn: 256126
llvm/lib/Target/X86/X86TargetTransformInfo.cpp
llvm/test/CodeGen/X86/constant-hoisting-cmp.ll [new file with mode: 0644]