Skip to content

Commit 4f489c1

Browse files
committed
Add a type arg
1 parent 9dae862 commit 4f489c1

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

llvm/docs/LangRef.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2742,7 +2742,7 @@ For example:
27422742
This attribute indicates that outlining passes should not modify the
27432743
function.
27442744

2745-
``"modular-format"="<string_idx>,<first_idx_to_check>,<modular_impl_fn>,<impl_name>,<aspects...>"``
2745+
``"modular-format"="<type>,<string_idx>,<first_idx_to_check>,<modular_impl_fn>,<impl_name>,<aspects...>"``
27462746
This attribute indicates that the implementation is modular on a particular
27472747
format string argument . When the argument for a given call is constant, the
27482748
compiler may redirect the call to a modular implementation function
@@ -2755,13 +2755,15 @@ For example:
27552755
brought into the link to satisfy weak references in the modular
27562756
implemenation function.
27572757

2758-
The first two arguments have the same semantics as the arguments to the C
2758+
The first three arguments have the same semantics as the arguments to the C
27592759
``format`` attribute.
27602760

27612761
The following aspects are currently supported:
27622762

27632763
- ``float``: The call has a floating point argument
27642764

2765+
2766+
27652767
Call Site Attributes
27662768
----------------------
27672769

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4078,18 +4078,18 @@ static Value *optimizeModularFormat(CallInst *CI, IRBuilderBase &B) {
40784078

40794079
SmallVector<StringRef> Args(
40804080
llvm::split(CI->getFnAttr("modular-format").getValueAsString(), ','));
4081-
// TODO: Examine the format argument in Args[0].
4081+
// TODO: Make use of the first two arguments
40824082
// TODO: Error handling
40834083
unsigned FirstArgIdx;
4084-
if (!llvm::to_integer(Args[1], FirstArgIdx))
4084+
if (!llvm::to_integer(Args[2], FirstArgIdx))
40854085
return nullptr;
40864086
if (FirstArgIdx == 0)
40874087
return nullptr;
40884088
--FirstArgIdx;
4089-
StringRef FnName = Args[2];
4090-
StringRef ImplName = Args[3];
4089+
StringRef FnName = Args[3];
4090+
StringRef ImplName = Args[4];
40914091
DenseSet<StringRef> Aspects(llvm::from_range,
4092-
ArrayRef<StringRef>(Args).drop_front(4));
4092+
ArrayRef<StringRef>(Args).drop_front(5));
40934093
Module *M = CI->getModule();
40944094
LLVMContext &Ctx = M->getContext();
40954095
Function *Callee = CI->getCalledFunction();

0 commit comments

Comments
 (0)