mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
apply Eli's patch for PR2165 and provide a testcase.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57625 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8e8b8a223c
commit
868510328f
@ -133,6 +133,12 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
|
||||
if (ConstantVector *CV = dyn_cast<ConstantVector>(V))
|
||||
return BitCastConstantVector(CV, DestPTy);
|
||||
}
|
||||
|
||||
// Canonicalize scalar-to-vector bitcasts into vector-to-vector bitcasts
|
||||
// This allows for other simplifications (although some of them
|
||||
// can only be handled by Analysis/ConstantFolding.cpp).
|
||||
if (isa<ConstantInt>(V) || isa<ConstantFP>(V))
|
||||
return ConstantExpr::getBitCast(ConstantVector::get(&V, 1), DestPTy);
|
||||
}
|
||||
|
||||
// Finally, implement bitcast folding now. The code below doesn't handle
|
||||
|
8
test/Transforms/ConstProp/bitcast2.ll
Normal file
8
test/Transforms/ConstProp/bitcast2.ll
Normal file
@ -0,0 +1,8 @@
|
||||
; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep bitcast
|
||||
; PR2165
|
||||
|
||||
define <1 x i64> @test() {
|
||||
%A = bitcast i64 63 to <1 x i64>
|
||||
ret <1 x i64> %A
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user