From f6efb2b30b725bb7bfe9206d263c80b094c5fc93 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 24 Jan 2015 11:12:57 +0000 Subject: [PATCH] [PM] Change LowerExpectIntrinsic to actually return true when it has changed the IR. This is particularly easy as we can just look for the existence of any expect intrinsic at all to know whether we've changed the IR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226998 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/LowerExpectIntrinsic.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp b/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp index 5d3bbbc6047..0cea5c5bc59 100644 --- a/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp +++ b/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp @@ -144,6 +144,8 @@ static bool handleBranchExpect(BranchInst &BI) { } bool LowerExpectIntrinsic::runOnFunction(Function &F) { + bool Changed = false; + for (BasicBlock &BB : F) { // Create "block_weights" metadata. if (BranchInst *BI = dyn_cast(BB.getTerminator())) { @@ -165,11 +167,12 @@ bool LowerExpectIntrinsic::runOnFunction(Function &F) { Value *Exp = CI->getArgOperand(0); CI->replaceAllUsesWith(Exp); CI->eraseFromParent(); + Changed = true; } } } - return false; + return Changed; } char LowerExpectIntrinsic::ID = 0; -- 2.34.1