summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorArtur Pilipenko <apilipenko@azulsystems.com>2015-10-09 15:58:26 +0000
committerArtur Pilipenko <apilipenko@azulsystems.com>2015-10-09 15:58:26 +0000
commitffd132878ab31f384f883a765cf1e6ab180d463b (patch)
tree5a57de0f5027c9d60286094765af706077b37e89 /llvm/lib/Analysis
parent7d9a419a3a918c0f28a984f5b4fa9c1a2a7fcfec (diff)
downloadbcm5719-llvm-ffd132878ab31f384f883a765cf1e6ab180d463b.tar.gz
bcm5719-llvm-ffd132878ab31f384f883a765cf1e6ab180d463b.zip
ValueTracking: use getAlignment in isAligned
Reviewed By: reames Differential Revision: http://reviews.llvm.org/D13517 llvm-svn: 249841
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp15
1 files changed, 1 insertions, 14 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 2259d871c8c..8b0850d105e 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2998,20 +2998,7 @@ static bool isDereferenceableFromAttribute(const Value *V, const DataLayout &DL,
static bool isAligned(const Value *Base, APInt Offset, unsigned Align,
const DataLayout &DL) {
- APInt BaseAlign(Offset.getBitWidth(), 0);
- if (const AllocaInst *AI = dyn_cast<AllocaInst>(Base))
- BaseAlign = AI->getAlignment();
- else if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(Base))
- BaseAlign = GV->getAlignment();
- else if (const Argument *A = dyn_cast<Argument>(Base))
- BaseAlign = A->getParamAlignment();
- else if (auto CS = ImmutableCallSite(Base))
- BaseAlign = CS.getAttributes().getParamAlignment(AttributeSet::ReturnIndex);
- else if (const LoadInst *LI = dyn_cast<LoadInst>(Base))
- if (MDNode *MD = LI->getMetadata(LLVMContext::MD_align)) {
- ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(0));
- BaseAlign = CI->getLimitedValue();
- }
+ APInt BaseAlign(Offset.getBitWidth(), getAlignment(Base, DL));
if (!BaseAlign) {
Type *Ty = Base->getType()->getPointerElementType();
OpenPOWER on IntegriCloud