diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-06-26 18:51:17 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-06-26 18:51:17 +0000 |
commit | 2c1a570aabc184e93f160992c3fe3eab8f884f74 (patch) | |
tree | 4accff69a6dbb2c0038ffeab5109107289a83133 /llvm/lib | |
parent | e745cf9bf31334cc89f0766269f904117f769b68 (diff) | |
download | bcm5719-llvm-2c1a570aabc184e93f160992c3fe3eab8f884f74.tar.gz bcm5719-llvm-2c1a570aabc184e93f160992c3fe3eab8f884f74.zip |
LoopUnroll: Allow analyzing intrinsic call costs
I'm not sure why the code here is skipping calls since
TTI does try to do something for general calls, but it
at least should allow intrinsics.
Skip intrinsics that should not be omitted as calls, which
is by far the most common case on AMDGPU.
llvm-svn: 335645
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp index b59e2be9f3b..797af471ed2 100644 --- a/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp +++ b/llvm/lib/Transforms/Scalar/LoopUnrollPass.cpp @@ -515,8 +515,13 @@ static Optional<EstimatedUnrollCost> analyzeLoopUnrollCost( // Can't properly model a cost of a call. // FIXME: With a proper cost model we should be able to do it. - if(isa<CallInst>(&I)) - return None; + if (auto *CI = dyn_cast<CallInst>(&I)) { + const Function *Callee = CI->getCalledFunction(); + if (!Callee || TTI.isLoweredToCall(Callee)) { + LLVM_DEBUG(dbgs() << "Can't analyze cost of loop with call\n"); + return None; + } + } // If the instruction might have a side-effect recursively account for // the cost of it and all the instructions leading up to it. |