Skip to content

Commit e1da6a4

Browse files
authored
Merge pull request #3185 from apple/eng/revert-2cae7025c1d9e83d971f670c9a66497a8c1094ec
Revert "Reland "[Clang] Propagate guaranteed alignment for malloc and…
2 parents 2e58005 + 7fb9da5 commit e1da6a4

File tree

3 files changed

+2
-55
lines changed

3 files changed

+2
-55
lines changed

clang/include/clang/Basic/TargetInfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,8 @@ class TargetInfo : public virtual TransferrableTargetInfo,
620620
}
621621

622622
/// Return the largest alignment for which a suitably-sized allocation with
623-
/// '::operator new(size_t)' or 'malloc' is guaranteed to produce a
624-
/// correctly-aligned pointer.
623+
/// '::operator new(size_t)' is guaranteed to produce a correctly-aligned
624+
/// pointer.
625625
unsigned getNewAlign() const {
626626
return NewAlign ? NewAlign : std::max(LongDoubleAlign, LongLongAlign);
627627
}

clang/lib/CodeGen/CGCall.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2060,24 +2060,6 @@ void CodeGenModule::ConstructAttributeList(StringRef Name,
20602060
// allows it to work on indirect virtual function calls.
20612061
if (AttrOnCallSite && TargetDecl->hasAttr<NoMergeAttr>())
20622062
FuncAttrs.addAttribute(llvm::Attribute::NoMerge);
2063-
2064-
// Add known guaranteed alignment for allocation functions.
2065-
if (unsigned BuiltinID = Fn->getBuiltinID()) {
2066-
switch (BuiltinID) {
2067-
case Builtin::BIaligned_alloc:
2068-
case Builtin::BIcalloc:
2069-
case Builtin::BImalloc:
2070-
case Builtin::BImemalign:
2071-
case Builtin::BIrealloc:
2072-
case Builtin::BIstrdup:
2073-
case Builtin::BIstrndup:
2074-
RetAttrs.addAlignmentAttr(Context.getTargetInfo().getNewAlign() /
2075-
Context.getTargetInfo().getCharWidth());
2076-
break;
2077-
default:
2078-
break;
2079-
}
2080-
}
20812063
}
20822064

20832065
// 'const', 'pure' and 'noalias' attributed functions are also nounwind.

clang/test/CodeGen/alloc-fns-alignment.c

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)