summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-10-17 01:11:57 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-10-17 01:11:57 +0000
commit602650c98822371d4a34b00353ec71051621b7fb (patch)
treed6b4d7c82ce7ba5d787d6f22a6c5c2b339793663 /include
parent1416dc29d8573e58c8b2d7fe0715f3e289d03ab8 (diff)
downloadllvm-602650c98822371d4a34b00353ec71051621b7fb.tar.gz
llvm-602650c98822371d4a34b00353ec71051621b7fb.tar.bz2
llvm-602650c98822371d4a34b00353ec71051621b7fb.tar.xz
Add a routine to swap branch instruction operands, and update any
profile metadata at the same time. Use it to preserve metadata attached to a branch when re-writing it in InstCombine. Add metadata to the canonicalize_branch InstCombine test, and check that it is tranformed correctly. Reviewed by Nick Lewycky! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142168 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Instructions.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Instructions.h b/include/llvm/Instructions.h
index 23e3e7e0f7..3faab35bf6 100644
--- a/include/llvm/Instructions.h
+++ b/include/llvm/Instructions.h
@@ -2367,6 +2367,13 @@ public:
*(&Op<-1>() - idx) = (Value*)NewSucc;
}
+ /// \brief Swap the successors of this branch instruction.
+ ///
+ /// Swaps the successors of the branch instruction. This also swaps any
+ /// branch weight metadata associated with the instruction so that it
+ /// continues to map correctly to each operand.
+ void swapSuccessors();
+
// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const BranchInst *) { return true; }
static inline bool classof(const Instruction *I) {