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 | 86f4f6526b18765cdb78bee593e1354bc9f55085 (patch) | |
tree | 278a13bbe43ee4dd5e75431ee9361e8b6182aa41 /lib/Transforms | |
parent | 16f385f90f481195bfcf6b139ced4cee033bb887 (diff) | |
download | external_llvm-86f4f6526b18765cdb78bee593e1354bc9f55085.zip external_llvm-86f4f6526b18765cdb78bee593e1354bc9f55085.tar.gz external_llvm-86f4f6526b18765cdb78bee593e1354bc9f55085.tar.bz2 |
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!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186510 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/Inliner.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp index f72121d..d75d6ca 100644 --- a/lib/Transforms/IPO/Inliner.cpp +++ b/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; |