[llvm-branch-commits] [llvm-branch] r245572 - Merging r245365 and r245369:
Hans Wennborg via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Aug 20 08:56:38 PDT 2015
Author: hans
Date: Thu Aug 20 10:56:38 2015
New Revision: 245572
URL: http://llvm.org/viewvc/llvm-project?rev=245572&view=rev
Log:
Merging r245365 and r245369:
------------------------------------------------------------------------
r245365 | majnemer | 2015-08-18 15:07:25 -0700 (Tue, 18 Aug 2015) | 4 lines
[InstSimplify] Don't assume getAggregateElement will succeed
It isn't always possible to get a value from getAggregateElement.
This fixes PR24488.
------------------------------------------------------------------------
------------------------------------------------------------------------
r245369 | majnemer | 2015-08-18 15:18:22 -0700 (Tue, 18 Aug 2015) | 3 lines
[InstSimplify] Remove unused variable
No functionality change is intended.
------------------------------------------------------------------------
Modified:
llvm/branches/release_37/ (props changed)
llvm/branches/release_37/lib/Analysis/InstructionSimplify.cpp
llvm/branches/release_37/lib/Analysis/VectorUtils.cpp
llvm/branches/release_37/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
Propchange: llvm/branches/release_37/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Aug 20 10:56:38 2015
@@ -1,3 +1,3 @@
/llvm/branches/Apple/Pertwee:110850,110961
/llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243057,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638-243640,243745,243891,243898,243927,243932,243934,243984,243986,243999,244058,244123,244232,244332,244418,244448,244554,244644,244659,244676,244789,244889,245064,245105,245119,245256,245355,245394-245395
+/llvm/trunk:155241,242236,242239,242281,242288,242296,242331,242341,242410,242412,242433-242434,242442,242543,242673,242680,242706,242721-242722,242733-242735,242742,242869,242919,242993,243001,243057,243116,243263,243294,243361,243469,243485,243500,243519,243531,243589,243609,243636,243638-243640,243745,243891,243898,243927,243932,243934,243984,243986,243999,244058,244123,244232,244332,244418,244448,244554,244644,244659,244676,244789,244889,245064,245105,245119,245256,245355,245365,245369,245394-245395
Modified: llvm/branches/release_37/lib/Analysis/InstructionSimplify.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/Analysis/InstructionSimplify.cpp?rev=245572&r1=245571&r2=245572&view=diff
==============================================================================
--- llvm/branches/release_37/lib/Analysis/InstructionSimplify.cpp (original)
+++ llvm/branches/release_37/lib/Analysis/InstructionSimplify.cpp Thu Aug 20 10:56:38 2015
@@ -3574,18 +3574,9 @@ static Value *SimplifyExtractElementInst
// If extracting a specified index from the vector, see if we can recursively
// find a previously computed scalar that was inserted into the vector.
- if (auto *IdxC = dyn_cast<ConstantInt>(Idx)) {
- unsigned IndexVal = IdxC->getZExtValue();
- unsigned VectorWidth = Vec->getType()->getVectorNumElements();
-
- // If this is extracting an invalid index, turn this into undef, to avoid
- // crashing the code below.
- if (IndexVal >= VectorWidth)
- return UndefValue::get(Vec->getType()->getVectorElementType());
-
- if (Value *Elt = findScalarElement(Vec, IndexVal))
+ if (auto *IdxC = dyn_cast<ConstantInt>(Idx))
+ if (Value *Elt = findScalarElement(Vec, IdxC->getZExtValue()))
return Elt;
- }
return nullptr;
}
Modified: llvm/branches/release_37/lib/Analysis/VectorUtils.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/lib/Analysis/VectorUtils.cpp?rev=245572&r1=245571&r2=245572&view=diff
==============================================================================
--- llvm/branches/release_37/lib/Analysis/VectorUtils.cpp (original)
+++ llvm/branches/release_37/lib/Analysis/VectorUtils.cpp Thu Aug 20 10:56:38 2015
@@ -402,8 +402,9 @@ llvm::Value *llvm::findScalarElement(llv
if (match(V,
llvm::PatternMatch::m_Add(llvm::PatternMatch::m_Value(Val),
llvm::PatternMatch::m_Constant(Con)))) {
- if (Con->getAggregateElement(EltNo)->isNullValue())
- return findScalarElement(Val, EltNo);
+ if (Constant *Elt = Con->getAggregateElement(EltNo))
+ if (Elt->isNullValue())
+ return findScalarElement(Val, EltNo);
}
// Otherwise, we don't know.
Modified: llvm/branches/release_37/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_37/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll?rev=245572&r1=245571&r2=245572&view=diff
==============================================================================
--- llvm/branches/release_37/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll (original)
+++ llvm/branches/release_37/test/Transforms/InstSimplify/2011-09-05-InsertExtractValue.ll Thu Aug 20 10:56:38 2015
@@ -36,3 +36,13 @@ define i32 @test3(i32 %a, float %b) {
; CHECK-LABEL: @test3(
; CHECK: ret i32 %a
}
+
+define i8 @test4(<8 x i8> %V) {
+ %add = add <8 x i8> %V, bitcast (double 0x319BEB8FD172E36 to <8 x i8>)
+ %extract = extractelement <8 x i8> %add, i32 6
+ ret i8 %extract
+; CHECK-LABEL: @test4(
+; CHECK: %[[add:.*]] = add <8 x i8> %V, bitcast (<1 x double> <double 0x319BEB8FD172E36> to <8 x i8>)
+; CHECK-NEXT: %[[extract:.*]] = extractelement <8 x i8> %[[add]], i32 6
+; CHECK-NEXT: ret i8 %[[extract]]
+}
More information about the llvm-branch-commits
mailing list