diff options
author | Hal Finkel <hfinkel@anl.gov> | 2013-07-17 14:32:41 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2013-07-17 14:32:41 +0000 |
commit | ec7cd269680336be3eb0a99e1752bba05eb07d38 (patch) | |
tree | 903d37971dcf6e17a18d9376fc0ab5394ae7a3bc /llvm/lib/Transforms | |
parent | a56115f785bddd06449702d5dc2896defaf23a4a (diff) | |
download | bcm5719-llvm-ec7cd269680336be3eb0a99e1752bba05eb07d38.tar.gz bcm5719-llvm-ec7cd269680336be3eb0a99e1752bba05eb07d38.zip |
Fix comparisons of alloca alignment in inliner merging
Duncan pointed out a mistake in my fix in r186425 when only one of the allocas
being compared had the target-default alignment. This is essentially his
suggested solution. Thanks!
llvm-svn: 186510
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index f72121d822f..d75d6ca92b3 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -216,9 +216,18 @@ static bool InlineCallIfPossible(CallSite CS, InlineFunctionInfo &IFI, AI->replaceAllUsesWith(AvailableAlloca); - if (Align1 > Align2 || (!Align1 && TD && - TD->getABITypeAlignment(AI->getAllocatedType()) > Align2)) - AvailableAlloca->setAlignment(Align1); + if (Align1 != Align2) { + if (!Align1 || !Align2) { + assert(TD && "DataLayout required to compare default alignments"); + unsigned TypeAlign = TD->getABITypeAlignment(AI->getAllocatedType()); + + Align1 = Align1 ? Align1 : TypeAlign; + Align2 = Align2 ? Align2 : TypeAlign; + } + + if (Align1 > Align2) + AvailableAlloca->setAlignment(AI->getAlignment()); + } AI->eraseFromParent(); MergedAwayAlloca = true; |