mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
Fix a bug around truncating vector in const prop.
In constant folding stage, "TRUNC" can't handle vector data type. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@216149 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
150cef218f
commit
82f1a8cc09
@ -674,6 +674,9 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, Constant *V,
|
||||
}
|
||||
return nullptr;
|
||||
case Instruction::Trunc: {
|
||||
if (V->getType()->isVectorTy())
|
||||
return nullptr;
|
||||
|
||||
uint32_t DestBitWidth = cast<IntegerType>(DestTy)->getBitWidth();
|
||||
if (ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
|
||||
return ConstantInt::get(V->getContext(),
|
||||
|
9
test/Transforms/ConstProp/trunc_vec.ll
Normal file
9
test/Transforms/ConstProp/trunc_vec.ll
Normal file
@ -0,0 +1,9 @@
|
||||
; RUN: opt -constprop < %s
|
||||
|
||||
; Make sure we don't crash on this one
|
||||
|
||||
define <8 x i8> @test_truc_vec() {
|
||||
%x = bitcast <2 x i64> <i64 1, i64 2> to <8 x i16>
|
||||
%y = trunc <8 x i16> %x to <8 x i8>
|
||||
ret <8 x i8> %y
|
||||
}
|
Loading…
Reference in New Issue
Block a user