mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 15:39:00 +00:00
Fix EnforceKnownAlignment so that it doesn't ever reduce the alignment
of an alloca or global variable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64693 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
e2a8dfefe5
commit
ecd0fb51cb
@ -9237,15 +9237,23 @@ static unsigned EnforceKnownAlignment(Value *V,
|
||||
// If there is a large requested alignment and we can, bump up the alignment
|
||||
// of the global.
|
||||
if (!GV->isDeclaration()) {
|
||||
GV->setAlignment(PrefAlign);
|
||||
Align = PrefAlign;
|
||||
if (GV->getAlignment() >= PrefAlign)
|
||||
Align = GV->getAlignment();
|
||||
else {
|
||||
GV->setAlignment(PrefAlign);
|
||||
Align = PrefAlign;
|
||||
}
|
||||
}
|
||||
} else if (AllocationInst *AI = dyn_cast<AllocationInst>(V)) {
|
||||
// If there is a requested alignment and if this is an alloca, round up. We
|
||||
// don't do this for malloc, because some systems can't respect the request.
|
||||
if (isa<AllocaInst>(AI)) {
|
||||
AI->setAlignment(PrefAlign);
|
||||
Align = PrefAlign;
|
||||
if (AI->getAlignment() >= PrefAlign)
|
||||
Align = AI->getAlignment();
|
||||
else {
|
||||
AI->setAlignment(PrefAlign);
|
||||
Align = PrefAlign;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
18
test/Transforms/InstCombine/enforce-known-alignment.ll
Normal file
18
test/Transforms/InstCombine/enforce-known-alignment.ll
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user