[Attributor][NFC] Avoid unnecessary string operations
authorJohannes Doerfert <johannes@jdoerfert.de>
Tue, 7 Feb 2023 14:17:08 +0000 (06:17 -0800)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 10 Feb 2023 17:56:09 +0000 (11:56 -0600)
This caused multiple string operations which we don't need if we do not
create a profile.

llvm/lib/Transforms/IPO/Attributor.cpp

index b11b881..69cd4e0 100644 (file)
@@ -2499,9 +2499,9 @@ ChangeStatus Attributor::run() {
 }
 
 ChangeStatus Attributor::updateAA(AbstractAttribute &AA) {
-  TimeTraceScope TimeScope(
-      AA.getName() + std::to_string(AA.getIRPosition().getPositionKind()) +
-      "::updateAA");
+  TimeTraceScope TimeScope("updateAA", [&]() {
+    return AA.getName() + std::to_string(AA.getIRPosition().getPositionKind());
+  });
   assert(Phase == AttributorPhase::UPDATE &&
          "We can update AA only in the update stage!");