Skip to content

Commit 6914a0e

Browse files
Revert "[Clang] Propagate guaranteed alignment for malloc and others"
This reverts commit c229754. Some buildbots are broken.
1 parent f2bf932 commit 6914a0e

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
@@ -612,8 +612,8 @@ class TargetInfo : public virtual TransferrableTargetInfo,
612612
}
613613

614614
/// Return the largest alignment for which a suitably-sized allocation with
615-
/// '::operator new(size_t)' or 'malloc' is guaranteed to produce a
616-
/// correctly-aligned pointer.
615+
/// '::operator new(size_t)' is guaranteed to produce a correctly-aligned
616+
/// pointer.
617617
unsigned getNewAlign() const {
618618
return NewAlign ? NewAlign : std::max(LongDoubleAlign, LongLongAlign);
619619
}

clang/lib/CodeGen/CGCall.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,24 +2048,6 @@ void CodeGenModule::ConstructAttributeList(
20482048
// allows it to work on indirect virtual function calls.
20492049
if (AttrOnCallSite && TargetDecl->hasAttr<NoMergeAttr>())
20502050
FuncAttrs.addAttribute(llvm::Attribute::NoMerge);
2051-
2052-
// Add known guaranteed alignment for allocation functions.
2053-
if (unsigned BuiltinID = Fn->getBuiltinID()) {
2054-
switch (BuiltinID) {
2055-
case Builtin::BIaligned_alloc:
2056-
case Builtin::BIcalloc:
2057-
case Builtin::BImalloc:
2058-
case Builtin::BImemalign:
2059-
case Builtin::BIrealloc:
2060-
case Builtin::BIstrdup:
2061-
case Builtin::BIstrndup:
2062-
RetAttrs.addAlignmentAttr(Context.getTargetInfo().getNewAlign() /
2063-
Context.getTargetInfo().getCharWidth());
2064-
break;
2065-
default:
2066-
break;
2067-
}
2068-
}
20692051
}
20702052

20712053
// '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)