mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
ConstantFold: Clean up X * undef code
No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223970 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
72c6bdbf70
commit
3e04c3e253
@ -915,11 +915,13 @@ Constant *llvm::ConstantFoldBinaryInstruction(unsigned Opcode,
|
|||||||
return C1;
|
return C1;
|
||||||
return Constant::getNullValue(C1->getType()); // undef & X -> 0
|
return Constant::getNullValue(C1->getType()); // undef & X -> 0
|
||||||
case Instruction::Mul: {
|
case Instruction::Mul: {
|
||||||
ConstantInt *CI;
|
// undef * undef -> undef
|
||||||
// X * undef -> undef if X is odd or undef
|
if (isa<UndefValue>(C1) && isa<UndefValue>(C2))
|
||||||
if (((CI = dyn_cast<ConstantInt>(C1)) && CI->getValue()[0]) ||
|
return C1;
|
||||||
((CI = dyn_cast<ConstantInt>(C2)) && CI->getValue()[0]) ||
|
const APInt *CV;
|
||||||
(isa<UndefValue>(C1) && isa<UndefValue>(C2)))
|
// X * undef -> undef if X is odd
|
||||||
|
if (match(C1, m_APInt(CV)) || match(C2, m_APInt(CV)))
|
||||||
|
if ((*CV)[0])
|
||||||
return UndefValue::get(C1->getType());
|
return UndefValue::get(C1->getType());
|
||||||
|
|
||||||
// X * undef -> 0 otherwise
|
// X * undef -> 0 otherwise
|
||||||
|
Loading…
Reference in New Issue
Block a user