diff options
author | Anat Shemer <anat.shemer@intel.com> | 2013-04-18 19:35:39 +0000 |
---|---|---|
committer | Anat Shemer <anat.shemer@intel.com> | 2013-04-18 19:35:39 +0000 |
commit | 77e95d04c430bc849aa1898cbd820517ec0f7465 (patch) | |
tree | 0c6916f575e09647faecfb1e6e6fa397248d12b2 /test/Transforms/InstCombine | |
parent | c0b4b6724c5887c839e236bea97016028fb5db19 (diff) | |
download | external_llvm-77e95d04c430bc849aa1898cbd820517ec0f7465.zip external_llvm-77e95d04c430bc849aa1898cbd820517ec0f7465.tar.gz external_llvm-77e95d04c430bc849aa1898cbd820517ec0f7465.tar.bz2 |
Added a function scalarizePHI() that sclarizes a vector phi instruction if it has only 2 uses: one to promote the vector phi in a loop and the other use is an extract operation of one element at a constant location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179783 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r-- | test/Transforms/InstCombine/vec_phi_extract.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/vec_phi_extract.ll b/test/Transforms/InstCombine/vec_phi_extract.ll new file mode 100644 index 0000000..2f10fc2 --- /dev/null +++ b/test/Transforms/InstCombine/vec_phi_extract.ll @@ -0,0 +1,27 @@ +; RUN: opt < %s -instcombine -S | FileCheck %s + +define void @f(i64 %val, i32 %limit, i32 *%ptr) { +;CHECK: %0 = trunc i64 +;CHECK: %1 = phi i32 +entry: + %tempvector = insertelement <16 x i64> undef, i64 %val, i32 0 + %vector = shufflevector <16 x i64> %tempvector, <16 x i64> undef, <16 x i32> zeroinitializer + %0 = add <16 x i64> %vector, <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15> + %1 = trunc <16 x i64> %0 to <16 x i32> + br label %loop + +loop: + %2 = phi <16 x i32> [ %1, %entry ], [ %inc, %loop ] + %elt = extractelement <16 x i32> %2, i32 0 + %end = icmp ult i32 %elt, %limit + %3 = add i32 10, %elt + %4 = sext i32 %elt to i64 + %5 = getelementptr i32* %ptr, i64 %4 + store i32 %3, i32* %5 + %inc = add <16 x i32> %2, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16> + br i1 %end, label %loop, label %ret + +ret: + ret void +} + |