summaryrefslogtreecommitdiff
path: root/test/Transforms/ConstantHoisting
diff options
context:
space:
mode:
authorJuergen Ributzka <juergen@apple.com>2014-04-12 02:36:28 +0000
committerJuergen Ributzka <juergen@apple.com>2014-04-12 02:36:28 +0000
commit940b67465dbd12240dfc3d88288b2da9563ccdd7 (patch)
tree167a5c72bddeb3a1496031c7e63bca95c95e2881 /test/Transforms/ConstantHoisting
parent9c9ef05445e4ebaf56e70f61e3fdcabc0ddcffc0 (diff)
downloadllvm-940b67465dbd12240dfc3d88288b2da9563ccdd7.tar.gz
llvm-940b67465dbd12240dfc3d88288b2da9563ccdd7.tar.bz2
llvm-940b67465dbd12240dfc3d88288b2da9563ccdd7.tar.xz
[ARM64] Fix the cost model for cheap large constants.
Originally the cost model would give up for large constants and just return the maximum cost. This is not what we want for constant hoisting, because some of these constants are large in bitwidth, but are still cheap to materialize. This commit fixes the cost model to either return TCC_Free if the cost cannot be determined, or accurately calculate the cost even for large constants (bitwidth > 128). This fixes <rdar://problem/16591573>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206100 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/ConstantHoisting')
-rw-r--r--test/Transforms/ConstantHoisting/ARM64/large-immediate.ll8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Transforms/ConstantHoisting/ARM64/large-immediate.ll b/test/Transforms/ConstantHoisting/ARM64/large-immediate.ll
index 0965a45ea6..92ad6ee70d 100644
--- a/test/Transforms/ConstantHoisting/ARM64/large-immediate.ll
+++ b/test/Transforms/ConstantHoisting/ARM64/large-immediate.ll
@@ -8,3 +8,11 @@ define i128 @test1(i128 %a) nounwind {
ret i128 %2
}
+; Check that we don't hoist large, but cheap constants
+define i512 @test2(i512 %a) nounwind {
+; CHECK-LABEL: test2
+; CHECK-NOT: %const = bitcast i512 7 to i512
+ %1 = and i512 %a, 7
+ %2 = or i512 %1, 7
+ ret i512 %2
+}