diff options
author | Sanjay Patel <spatel@rotateright.com> | 2019-06-14 15:05:35 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2019-06-14 15:05:35 +0000 |
commit | 7ea378b940b4c4d0690a67679c7d291743e3c8ed (patch) | |
tree | 24f13613af45f728418cb0388b3999981ee64cde /llvm | |
parent | 282d34ee78cd878a8554274c4a08feedb6ac2062 (diff) | |
download | bcm5719-llvm-7ea378b940b4c4d0690a67679c7d291743e3c8ed.tar.gz bcm5719-llvm-7ea378b940b4c4d0690a67679c7d291743e3c8ed.zip |
[CodeGenPrepare] propagate debuginfo when copying a shuffle
llvm-svn: 363409
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/CodeGen/CodeGenPrepare.cpp | 1 | ||||
-rw-r--r-- | llvm/test/Transforms/CodeGenPrepare/X86/vec-shift.ll | 32 |
2 files changed, 19 insertions, 14 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 797064b68c7..56f6629f5b1 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -6138,6 +6138,7 @@ bool CodeGenPrepare::optimizeShuffleVectorInst(ShuffleVectorInst *SVI) { InsertedShuffle = new ShuffleVectorInst(SVI->getOperand(0), SVI->getOperand(1), SVI->getOperand(2), "", &*InsertPt); + InsertedShuffle->setDebugLoc(SVI->getDebugLoc()); } UI->replaceUsesOfWith(SVI, InsertedShuffle); diff --git a/llvm/test/Transforms/CodeGenPrepare/X86/vec-shift.ll b/llvm/test/Transforms/CodeGenPrepare/X86/vec-shift.ll index 098a65a397c..79e3401d3e8 100644 --- a/llvm/test/Transforms/CodeGenPrepare/X86/vec-shift.ll +++ b/llvm/test/Transforms/CodeGenPrepare/X86/vec-shift.ll @@ -1,6 +1,22 @@ ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py ; RUN: opt -codegenprepare -mtriple=x86_64-- -mattr=avx -S < %s | FileCheck %s --check-prefixes=ALL,AVX ; RUN: opt -codegenprepare -mtriple=x86_64-- -mattr=avx2 -S < %s | FileCheck %s --check-prefixes=ALL,AVX2 +; RUN: opt -codegenprepare -mtriple=x86_64-- -mattr=avx -S -enable-debugify < %s 2>&1 | FileCheck %s -check-prefix=DEBUG + +define <4 x i32> @vector_variable_shift_right(<4 x i1> %cond, <4 x i32> %x, <4 x i32> %y, <4 x i32> %z) { +; ALL-LABEL: @vector_variable_shift_right( +; ALL-NEXT: [[SPLAT1:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer +; ALL-NEXT: [[SPLAT2:%.*]] = shufflevector <4 x i32> [[Y:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer +; ALL-NEXT: [[SEL:%.*]] = select <4 x i1> [[COND:%.*]], <4 x i32> [[SPLAT1]], <4 x i32> [[SPLAT2]] +; ALL-NEXT: [[SH:%.*]] = lshr <4 x i32> [[Z:%.*]], [[SEL]] +; ALL-NEXT: ret <4 x i32> [[SH]] +; + %splat1 = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer + %splat2 = shufflevector <4 x i32> %y, <4 x i32> undef, <4 x i32> zeroinitializer + %sel = select <4 x i1> %cond, <4 x i32> %splat1, <4 x i32> %splat2 + %sh = lshr <4 x i32> %z, %sel + ret <4 x i32> %sh +} ; PR37428 - https://bugs.llvm.org/show_bug.cgi?id=37428 @@ -101,17 +117,5 @@ exit: ret void } -define <4 x i32> @vector_variable_shift_right(<4 x i1> %cond, <4 x i32> %x, <4 x i32> %y, <4 x i32> %z) { -; ALL-LABEL: @vector_variable_shift_right( -; ALL-NEXT: [[SPLAT1:%.*]] = shufflevector <4 x i32> [[X:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer -; ALL-NEXT: [[SPLAT2:%.*]] = shufflevector <4 x i32> [[Y:%.*]], <4 x i32> undef, <4 x i32> zeroinitializer -; ALL-NEXT: [[SEL:%.*]] = select <4 x i1> [[COND:%.*]], <4 x i32> [[SPLAT1]], <4 x i32> [[SPLAT2]] -; ALL-NEXT: [[SH:%.*]] = lshr <4 x i32> [[Z:%.*]], [[SEL]] -; ALL-NEXT: ret <4 x i32> [[SH]] -; - %splat1 = shufflevector <4 x i32> %x, <4 x i32> undef, <4 x i32> zeroinitializer - %splat2 = shufflevector <4 x i32> %y, <4 x i32> undef, <4 x i32> zeroinitializer - %sel = select <4 x i1> %cond, <4 x i32> %splat1, <4 x i32> %splat2 - %sh = lshr <4 x i32> %z, %sel - ret <4 x i32> %sh -} +; Check that every instruction inserted by -codegenprepare has a debug location. +; DEBUG: CheckModuleDebugify: PASS |