aboutsummaryrefslogtreecommitdiffstats
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-09-07 23:54:19 +0000
committerDan Gohman <gohman@apple.com>2009-09-07 23:54:19 +0000
commitf3a08b82db22aa66dd10f9a939993c7797baf32e (patch)
treea200a06bc5c88ef39c60b3fab3b1d76c3052c8e6 /lib/AsmParser
parentc4d34a74cd602a2a0438efade40a536d67ed38a3 (diff)
downloadexternal_llvm-f3a08b82db22aa66dd10f9a939993c7797baf32e.zip
external_llvm-f3a08b82db22aa66dd10f9a939993c7797baf32e.tar.gz
external_llvm-f3a08b82db22aa66dd10f9a939993c7797baf32e.tar.bz2
Reappy r80998, now that the GlobalOpt bug that it exposed on MiniSAT is fixed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81172 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/LLParser.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp
index 3ef4aaf..b7b95d7 100644
--- a/lib/AsmParser/LLParser.cpp
+++ b/lib/AsmParser/LLParser.cpp
@@ -2095,13 +2095,11 @@ bool LLParser::ParseValID(ValID &ID) {
if (!Val0->getType()->isIntOrIntVector() &&
!Val0->getType()->isFPOrFPVector())
return Error(ID.Loc,"constexpr requires integer, fp, or vector operands");
- Constant *C = ConstantExpr::get(Opc, Val0, Val1);
- if (NUW)
- cast<OverflowingBinaryOperator>(C)->setHasNoUnsignedWrap(true);
- if (NSW)
- cast<OverflowingBinaryOperator>(C)->setHasNoSignedWrap(true);
- if (Exact)
- cast<SDivOperator>(C)->setIsExact(true);
+ unsigned Flags = 0;
+ if (NUW) Flags |= OverflowingBinaryOperator::NoUnsignedWrap;
+ if (NSW) Flags |= OverflowingBinaryOperator::NoSignedWrap;
+ if (Exact) Flags |= SDivOperator::IsExact;
+ Constant *C = ConstantExpr::get(Opc, Val0, Val1, Flags);
ID.ConstantVal = C;
ID.Kind = ValID::t_Constant;
return false;
@@ -2157,10 +2155,12 @@ bool LLParser::ParseValID(ValID &ID) {
(Value**)(Elts.data() + 1),
Elts.size() - 1))
return Error(ID.Loc, "invalid indices for getelementptr");
- ID.ConstantVal = ConstantExpr::getGetElementPtr(Elts[0],
- Elts.data() + 1, Elts.size() - 1);
- if (InBounds)
- cast<GEPOperator>(ID.ConstantVal)->setIsInBounds(true);
+ ID.ConstantVal = InBounds ?
+ ConstantExpr::getInBoundsGetElementPtr(Elts[0],
+ Elts.data() + 1,
+ Elts.size() - 1) :
+ ConstantExpr::getGetElementPtr(Elts[0],
+ Elts.data() + 1, Elts.size() - 1);
} else if (Opc == Instruction::Select) {
if (Elts.size() != 3)
return Error(ID.Loc, "expected three operands to select");
@@ -2681,9 +2681,9 @@ bool LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
return Error(ModifierLoc, "nsw only applies to integer operations");
}
if (NUW)
- cast<OverflowingBinaryOperator>(Inst)->setHasNoUnsignedWrap(true);
+ cast<BinaryOperator>(Inst)->setHasNoUnsignedWrap(true);
if (NSW)
- cast<OverflowingBinaryOperator>(Inst)->setHasNoSignedWrap(true);
+ cast<BinaryOperator>(Inst)->setHasNoSignedWrap(true);
}
return Result;
}
@@ -2698,7 +2698,7 @@ bool LLParser::ParseInstruction(Instruction *&Inst, BasicBlock *BB,
bool Result = ParseArithmetic(Inst, PFS, KeywordVal, 1);
if (!Result)
if (Exact)
- cast<SDivOperator>(Inst)->setIsExact(true);
+ cast<BinaryOperator>(Inst)->setIsExact(true);
return Result;
}
@@ -3501,7 +3501,7 @@ bool LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
return Error(Loc, "invalid getelementptr indices");
Inst = GetElementPtrInst::Create(Ptr, Indices.begin(), Indices.end());
if (InBounds)
- cast<GEPOperator>(Inst)->setIsInBounds(true);
+ cast<GetElementPtrInst>(Inst)->setIsInBounds(true);
return false;
}