[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)
commita1d9ba7078eaf0fcab135420e9f294029a2105ff
tree99e8083c0394f16b53fad0372489562eb8ce6746
parent9a2a614b983da3d0aeb9868c0a18a49051d34cda
[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256126 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86TargetTransformInfo.cpp
test/CodeGen/X86/constant-hoisting-cmp.ll [new file with mode: 0644]