summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnat Shemer <anat.shemer@intel.com>2013-04-18 19:56:44 +0000
committerAnat Shemer <anat.shemer@intel.com>2013-04-18 19:56:44 +0000
commit86dc3f3739eedc26f2fd1f6ade1633c1fa84bd7d (patch)
treed6fb62e5c535dbe6b5d9d104c705fc8ea7eb7dfc /lib
parent4bfeee1302eaeb6cf8f4248e3bb4fdf31a11dce1 (diff)
In the function InstCombiner::visitExtractElementInst() removed the limitation that extract is promoted over a cast only if the cast has only one use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179786 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/InstCombine/InstCombineVectorOps.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
index d13c2af4727..79e16f13ad0 100644
--- a/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
+++ b/lib/Transforms/InstCombine/InstCombineVectorOps.cpp
@@ -278,10 +278,10 @@ Instruction *InstCombiner::visitExtractElementInst(ExtractElementInst &EI) {
} else if (CastInst *CI = dyn_cast<CastInst>(I)) {
// Canonicalize extractelement(cast) -> cast(extractelement)
// bitcasts can change the number of vector elements and they cost nothing
- if (CI->hasOneUse() && EI.hasOneUse() &&
- (CI->getOpcode() != Instruction::BitCast)) {
- Value *EE = Builder->CreateExtractElement(CI->getOperand(0),
- EI.getIndexOperand());
+ if (CI->hasOneUse() && (CI->getOpcode() != Instruction::BitCast)) {
+ Value *EE = InsertNewInstWith(
+ ExtractElementInst::Create(CI->getOperand(0), EI.getIndexOperand()),
+ *CI);
return CastInst::Create(CI->getOpcode(), EE, EI.getType());
}
}