summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp3
-rw-r--r--llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp6
-rw-r--r--llvm/lib/Transforms/TransformInternals.h4
3 files changed, 3 insertions, 10 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 0ecec730d90..33de49d391d 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -370,8 +370,7 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
if (Constant *Op1 = dyn_cast<Constant>(I.getOperand(1))) {
if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
const Type *Ty = CI->getType();
- int64_t Val = Ty->isSigned() ? cast<ConstantSInt>(CI)->getValue() :
- (int64_t)cast<ConstantUInt>(CI)->getValue();
+ int64_t Val = (int64_t)cast<ConstantInt>(CI)->getRawValue();
switch (Val) {
case -1: // X * -1 -> -X
return BinaryOperator::createNeg(Op0, I.getName());
diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index f0e51e589d7..fceaccc89a5 100644
--- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
@@ -103,11 +103,7 @@ bool SROA::runOnFunction(Function &F) {
Instruction *User = cast<Instruction>(*I);
if (GetElementPtrInst *GEPI = dyn_cast<GetElementPtrInst>(User)) {
// We now know that the GEP is of the form: GEP <ptr>, 0, <cst>
- uint64_t Idx;
- if (ConstantSInt *CSI = dyn_cast<ConstantSInt>(GEPI->getOperand(2)))
- Idx = CSI->getValue();
- else
- Idx = cast<ConstantUInt>(GEPI->getOperand(2))->getValue();
+ uint64_t Idx = cast<ConstantInt>(GEPI->getOperand(2))->getRawValue();
assert(Idx < ElementAllocas.size() && "Index out of range?");
AllocaInst *AllocaToUse = ElementAllocas[Idx];
diff --git a/llvm/lib/Transforms/TransformInternals.h b/llvm/lib/Transforms/TransformInternals.h
index 8cab4293496..5f87a38cc4c 100644
--- a/llvm/lib/Transforms/TransformInternals.h
+++ b/llvm/lib/Transforms/TransformInternals.h
@@ -16,9 +16,7 @@
#include <set>
static inline int64_t getConstantValue(const ConstantInt *CPI) {
- if (const ConstantSInt *CSI = dyn_cast<ConstantSInt>(CPI))
- return CSI->getValue();
- return (int64_t)cast<ConstantUInt>(CPI)->getValue();
+ return (int64_t)cast<ConstantInt>(CPI)->getRawValue();
}
OpenPOWER on IntegriCloud