mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
Fix SCEVExpander::visitSMaxExpr and SCEVExpander::visitUMaxExpr to
not create ICmpInsts with operands of different types. This fixes a regression in Applications/d/make_dparser. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69294 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f04fa483b8
commit
6524d3ab0e
@ -295,9 +295,13 @@ Value *SCEVExpander::visitSignExtendExpr(SCEVSignExtendExpr *S) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Value *SCEVExpander::visitSMaxExpr(SCEVSMaxExpr *S) {
|
Value *SCEVExpander::visitSMaxExpr(SCEVSMaxExpr *S) {
|
||||||
|
const Type *Ty = S->getType();
|
||||||
Value *LHS = expand(S->getOperand(0));
|
Value *LHS = expand(S->getOperand(0));
|
||||||
|
LHS = InsertCastOfTo(CastInst::getCastOpcode(LHS, false, Ty, false), LHS, Ty);
|
||||||
for (unsigned i = 1; i < S->getNumOperands(); ++i) {
|
for (unsigned i = 1; i < S->getNumOperands(); ++i) {
|
||||||
Value *RHS = expand(S->getOperand(i));
|
Value *RHS = expand(S->getOperand(i));
|
||||||
|
RHS = InsertCastOfTo(CastInst::getCastOpcode(RHS, false, Ty, false),
|
||||||
|
RHS, Ty);
|
||||||
Value *ICmp = new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS, "tmp", InsertPt);
|
Value *ICmp = new ICmpInst(ICmpInst::ICMP_SGT, LHS, RHS, "tmp", InsertPt);
|
||||||
LHS = SelectInst::Create(ICmp, LHS, RHS, "smax", InsertPt);
|
LHS = SelectInst::Create(ICmp, LHS, RHS, "smax", InsertPt);
|
||||||
}
|
}
|
||||||
@ -305,9 +309,13 @@ Value *SCEVExpander::visitSMaxExpr(SCEVSMaxExpr *S) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Value *SCEVExpander::visitUMaxExpr(SCEVUMaxExpr *S) {
|
Value *SCEVExpander::visitUMaxExpr(SCEVUMaxExpr *S) {
|
||||||
|
const Type *Ty = S->getType();
|
||||||
Value *LHS = expand(S->getOperand(0));
|
Value *LHS = expand(S->getOperand(0));
|
||||||
|
LHS = InsertCastOfTo(CastInst::getCastOpcode(LHS, false, Ty, false), LHS, Ty);
|
||||||
for (unsigned i = 1; i < S->getNumOperands(); ++i) {
|
for (unsigned i = 1; i < S->getNumOperands(); ++i) {
|
||||||
Value *RHS = expand(S->getOperand(i));
|
Value *RHS = expand(S->getOperand(i));
|
||||||
|
RHS = InsertCastOfTo(CastInst::getCastOpcode(RHS, false, Ty, false),
|
||||||
|
RHS, Ty);
|
||||||
Value *ICmp = new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS, "tmp", InsertPt);
|
Value *ICmp = new ICmpInst(ICmpInst::ICMP_UGT, LHS, RHS, "tmp", InsertPt);
|
||||||
LHS = SelectInst::Create(ICmp, LHS, RHS, "umax", InsertPt);
|
LHS = SelectInst::Create(ICmp, LHS, RHS, "umax", InsertPt);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user