Skip to content

Commit 326fcc3

Browse files
committed
Add a type arg
1 parent de9ebec commit 326fcc3

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
@@ -2620,7 +2620,7 @@ For example:
26202620
This attribute indicates that outlining passes should not modify the
26212621
function.
26222622

2623-
``"modular-format"="<string_idx>,<first_idx_to_check>,<modular_impl_fn>,<impl_name>,<aspects...>"``
2623+
``"modular-format"="<type>,<string_idx>,<first_idx_to_check>,<modular_impl_fn>,<impl_name>,<aspects...>"``
26242624
This attribute indicates that the implementation is modular on a particular
26252625
format string argument . When the argument for a given call is constant, the
26262626
compiler may redirect the call to a modular implementation function
@@ -2633,13 +2633,15 @@ For example:
26332633
brought into the link to satisfy weak references in the modular
26342634
implemenation function.
26352635

2636-
The first two arguments have the same semantics as the arguments to the C
2636+
The first three arguments have the same semantics as the arguments to the C
26372637
``format`` attribute.
26382638

26392639
The following aspects are currently supported:
26402640

26412641
- ``float``: The call has a floating point argument
26422642

2643+
2644+
26432645
Call Site Attributes
26442646
----------------------
26452647

llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp

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

39233923
SmallVector<StringRef> Args(
39243924
llvm::split(CI->getFnAttr("modular-format").getValueAsString(), ','));
3925-
// TODO: Examine the format argument in Args[0].
3925+
// TODO: Make use of the first two arguments
39263926
// TODO: Error handling
39273927
unsigned FirstArgIdx;
3928-
if (!llvm::to_integer(Args[1], FirstArgIdx))
3928+
if (!llvm::to_integer(Args[2], FirstArgIdx))
39293929
return nullptr;
39303930
if (FirstArgIdx == 0)
39313931
return nullptr;
39323932
--FirstArgIdx;
3933-
StringRef FnName = Args[2];
3934-
StringRef ImplName = Args[3];
3933+
StringRef FnName = Args[3];
3934+
StringRef ImplName = Args[4];
39353935
DenseSet<StringRef> Aspects(llvm::from_range,
3936-
ArrayRef<StringRef>(Args).drop_front(4));
3936+
ArrayRef<StringRef>(Args).drop_front(5));
39373937
Module *M = CI->getModule();
39383938
LLVMContext &Ctx = M->getContext();
39393939
Function *Callee = CI->getCalledFunction();

0 commit comments

Comments
 (0)