Skip to content

Commit 450ead1

Browse files
committed
Remove isa<Constant*> check
1 parent 81a47b5 commit 450ead1

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

llvm/lib/IR/ConstantFold.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,7 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
160160
// If the cast operand is a constant vector, perform the cast by
161161
// operating on each element. In the cast of bitcasts, the element
162162
// count may be mismatched; don't attempt to handle that here.
163-
if ((isa<ConstantVector, ConstantDataVector, ConstantExpr>(V)) &&
164-
DestTy->isVectorTy() && V->getType()->isVectorTy() &&
163+
if (DestTy->isVectorTy() && V->getType()->isVectorTy() &&
165164
cast<VectorType>(DestTy)->getElementCount() ==
166165
cast<VectorType>(V->getType())->getElementCount()) {
167166
VectorType *DestVecTy = cast<VectorType>(DestTy);

llvm/test/Transforms/InstCombine/addrspacecast.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ define ptr addrspace(4) @constant_fold_undef() #0 {
191191

192192
define <4 x ptr addrspace(4)> @constant_fold_null_vector() #0 {
193193
; CHECK-LABEL: @constant_fold_null_vector(
194-
; CHECK-NEXT: ret <4 x ptr addrspace(4)> addrspacecast (<4 x ptr addrspace(3)> zeroinitializer to <4 x ptr addrspace(4)>)
194+
; CHECK-NEXT: ret <4 x ptr addrspace(4)> <ptr addrspace(4) addrspacecast (ptr addrspace(3) null to ptr addrspace(4)), ptr addrspace(4) addrspacecast (ptr addrspace(3) null to ptr addrspace(4)), ptr addrspace(4) addrspacecast (ptr addrspace(3) null to ptr addrspace(4)), ptr addrspace(4) addrspacecast (ptr addrspace(3) null to ptr addrspace(4))>
195195
;
196196
%cast = addrspacecast <4 x ptr addrspace(3)> zeroinitializer to <4 x ptr addrspace(4)>
197197
ret <4 x ptr addrspace(4)> %cast

0 commit comments

Comments
 (0)