diff options
author | Jonas Paulsson <paulsson@linux.vnet.ibm.com> | 2019-12-18 10:12:41 -0800 |
---|---|---|
committer | Jonas Paulsson <paulsson@linux.vnet.ibm.com> | 2019-12-18 11:04:13 -0800 |
commit | ca520592c081a76b45613ec794ebee4920933c1c (patch) | |
tree | 908961ccd650f68380843885953decebd5dd6cee | |
parent | fc0731b98a67c793862288f8ae334322666214dc (diff) | |
download | bcm5719-llvm-ca520592c081a76b45613ec794ebee4920933c1c.tar.gz bcm5719-llvm-ca520592c081a76b45613ec794ebee4920933c1c.zip |
[Clang FE, SystemZ] Don't add "true" value for the "mnop-mcount" attribute.
Let the "mnop-mcount" function attribute simply be present or non-present.
Update SystemZ backend as well to use hasFnAttribute() instead.
Review: Ulrich Weigand
https://reviews.llvm.org/D71669
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 2 | ||||
-rw-r--r-- | clang/test/CodeGen/mnop-mcount.c | 4 | ||||
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/mnop-mcount-01.ll | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/SystemZ/mnop-mcount-02.ll | 3 |
6 files changed, 7 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 0db17431814..89ce31e9b45 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -966,7 +966,7 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, if (!CGM.getCodeGenOpts().CallFEntry) CGM.getDiags().Report(diag::err_opt_not_valid_without_opt) << "-mnop-mcount" << "-mfentry"; - Fn->addFnAttr("mnop-mcount", "true"); + Fn->addFnAttr("mnop-mcount"); } } } diff --git a/clang/test/CodeGen/mnop-mcount.c b/clang/test/CodeGen/mnop-mcount.c index 08d000dc413..a6b10b62505 100644 --- a/clang/test/CodeGen/mnop-mcount.c +++ b/clang/test/CodeGen/mnop-mcount.c @@ -17,9 +17,9 @@ int __attribute__((no_instrument_function)) no_instrument(void) { return foo(); } -//CHECK: attributes #0 = { {{.*}}"mnop-mcount"="true"{{.*}} } +//CHECK: attributes #0 = { {{.*}}"mnop-mcount"{{.*}} } //CHECK: attributes #1 = { {{.*}} } -//CHECK-NOT: attributes #1 = { {{.*}}"mnop-mcount"="true"{{.*}} } +//CHECK-NOT: attributes #1 = { {{.*}}"mnop-mcount"{{.*}} } //NOMFENTRY: error: option '-mnop-mcount' cannot be specified without '-mfentry' //NOPG-NOT: attributes #0 = { {{.*}}"mnop-mcount"{{.*}} } //NOPG-NOT: attributes #1 = { {{.*}}"mnop-mcount"{{.*}} } diff --git a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp index 10023e9e169..34f7bc99a0d 100644 --- a/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp +++ b/llvm/lib/Target/SystemZ/SystemZAsmPrinter.cpp @@ -553,8 +553,7 @@ static unsigned EmitNop(MCContext &OutContext, MCStreamer &OutStreamer, void SystemZAsmPrinter::LowerFENTRY_CALL(const MachineInstr &MI, SystemZMCInstLower &Lower) { MCContext &Ctx = MF->getContext(); - if (MF->getFunction().getFnAttribute("mnop-mcount") - .getValueAsString() == "true") { + if (MF->getFunction().hasFnAttribute("mnop-mcount")) { EmitNop(Ctx, *OutStreamer, 6, getSubtargetInfo()); return; } diff --git a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp index 751034c2d41..0bcbce68a5f 100644 --- a/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp +++ b/llvm/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp @@ -347,7 +347,7 @@ public: bool runOnMachineFunction(MachineFunction &MF) override { const Function &F = MF.getFunction(); - if (F.getFnAttribute("mnop-mcount").getValueAsString() == "true" && + if (F.hasFnAttribute("mnop-mcount") && F.getFnAttribute("fentry-call").getValueAsString() != "true") report_fatal_error("mnop-mcount only supported with fentry-call"); diff --git a/llvm/test/CodeGen/SystemZ/mnop-mcount-01.ll b/llvm/test/CodeGen/SystemZ/mnop-mcount-01.ll index 38f1db537b5..99aff5a223e 100644 --- a/llvm/test/CodeGen/SystemZ/mnop-mcount-01.ll +++ b/llvm/test/CodeGen/SystemZ/mnop-mcount-01.ll @@ -22,5 +22,5 @@ entry: } attributes #0 = { "fentry-call"="true" } -attributes #1 = { "fentry-call"="true" "mnop-mcount"="true" } +attributes #1 = { "fentry-call"="true" "mnop-mcount" } diff --git a/llvm/test/CodeGen/SystemZ/mnop-mcount-02.ll b/llvm/test/CodeGen/SystemZ/mnop-mcount-02.ll index 19b1724d16a..4a362911131 100644 --- a/llvm/test/CodeGen/SystemZ/mnop-mcount-02.ll +++ b/llvm/test/CodeGen/SystemZ/mnop-mcount-02.ll @@ -7,5 +7,4 @@ entry: ret void } -attributes #0 = { "instrument-function-entry-inlined"="mcount" "mnop-mcount"="true" } - +attributes #0 = { "instrument-function-entry-inlined"="mcount" "mnop-mcount" } |