mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-26 13:36:28 +00:00
Add support for constant select expressions. Clarify the assertion failure msg.
llvm-svn: 12613
This commit is contained in:
parent
b9a26ff8fc
commit
3fb4f87195
@ -125,10 +125,24 @@ static Instruction* DecomposeConstantExpr(ConstantExpr* CE,
|
|||||||
std::vector<Value*>(CE->op_begin()+1, CE->op_end()),
|
std::vector<Value*>(CE->op_begin()+1, CE->op_end()),
|
||||||
"constantGEP", &insertBefore);
|
"constantGEP", &insertBefore);
|
||||||
|
|
||||||
|
case Instruction::Select: {
|
||||||
|
Value *C, *S1, *S2;
|
||||||
|
C = CE->getOperand (0);
|
||||||
|
if (ConstantExpr* CEarg = dyn_cast<ConstantExpr> (C))
|
||||||
|
C = DecomposeConstantExpr (CEarg, insertBefore);
|
||||||
|
S1 = CE->getOperand (1);
|
||||||
|
if (ConstantExpr* CEarg = dyn_cast<ConstantExpr> (S1))
|
||||||
|
S1 = DecomposeConstantExpr (CEarg, insertBefore);
|
||||||
|
S2 = CE->getOperand (2);
|
||||||
|
if (ConstantExpr* CEarg = dyn_cast<ConstantExpr> (S2))
|
||||||
|
S2 = DecomposeConstantExpr (CEarg, insertBefore);
|
||||||
|
return new SelectInst (C, S1, S2);
|
||||||
|
}
|
||||||
|
|
||||||
default: // must be a binary operator
|
default: // must be a binary operator
|
||||||
assert(CE->getOpcode() >= Instruction::BinaryOpsBegin &&
|
assert(CE->getOpcode() >= Instruction::BinaryOpsBegin &&
|
||||||
CE->getOpcode() < Instruction::BinaryOpsEnd &&
|
CE->getOpcode() < Instruction::BinaryOpsEnd &&
|
||||||
"Unrecognized opcode in ConstantExpr");
|
"Unhandled opcode in ConstantExpr");
|
||||||
getArg1 = CE->getOperand(0);
|
getArg1 = CE->getOperand(0);
|
||||||
if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg1))
|
if (ConstantExpr* CEarg = dyn_cast<ConstantExpr>(getArg1))
|
||||||
getArg1 = DecomposeConstantExpr(CEarg, insertBefore);
|
getArg1 = DecomposeConstantExpr(CEarg, insertBefore);
|
||||||
|
Loading…
Reference in New Issue
Block a user