[llvm] r305737 - [PATCH] [PGO] Fixed cast operation in emIntrinsicVisitor::instrumentOneMemIntrinsic.
Ana Pazos via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 19 13:04:33 PDT 2017
Author: apazos
Date: Mon Jun 19 15:04:33 2017
New Revision: 305737
URL: http://llvm.org/viewvc/llvm-project?rev=305737&view=rev
Log:
[PATCH] [PGO] Fixed cast operation in emIntrinsicVisitor::instrumentOneMemIntrinsic.
Reviewers: xur, efriedma, davidxl
Reviewed By: davidxl
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D34293
Added:
llvm/trunk/test/Transforms/PGOProfile/memop_size_from_strlen.ll
Modified:
llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=305737&r1=305736&r2=305737&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Mon Jun 19 15:04:33 2017
@@ -1177,7 +1177,7 @@ void MemIntrinsicVisitor::instrumentOneM
Builder.CreateCall(
Intrinsic::getDeclaration(M, Intrinsic::instrprof_value_profile),
{llvm::ConstantExpr::getBitCast(FuncNameVar, I8PtrTy),
- Builder.getInt64(FuncHash), Builder.CreatePtrToInt(Length, Int64Ty),
+ Builder.getInt64(FuncHash), Builder.CreateZExtOrTrunc(Length, Int64Ty),
Builder.getInt32(IPVK_MemOPSize), Builder.getInt32(CurCtrId)});
++CurCtrId;
}
Added: llvm/trunk/test/Transforms/PGOProfile/memop_size_from_strlen.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PGOProfile/memop_size_from_strlen.ll?rev=305737&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/PGOProfile/memop_size_from_strlen.ll (added)
+++ llvm/trunk/test/Transforms/PGOProfile/memop_size_from_strlen.ll Mon Jun 19 15:04:33 2017
@@ -0,0 +1,14 @@
+; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s
+
+declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture writeonly, i8* nocapture readonly, i32, i32, i1)
+declare i32 @strlen(i8* nocapture)
+
+; CHECK_LABEL: test
+; CHECK: %1 = zext i32 %c to i64
+; CHECK: call void @llvm.instrprof.value.profile(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__profn_test, i32 0, i32 0), i64 12884901887, i64 %1, i32 1, i32 0)
+
+define void @test(i8* %a, i8* %p) {
+ %c = call i32 @strlen(i8* %p)
+ call void @llvm.memcpy.p0i8.p0i8.i32(i8* %a, i8* %p, i32 %c, i32 1, i1 false)
+ ret void
+}
More information about the llvm-commits
mailing list