diff options
author | Florian Hahn <flo@fhahn.com> | 2020-07-09 09:43:16 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2020-07-09 09:51:18 +0100 |
commit | b805e944773e119461903e5140389072c02796bf (patch) | |
tree | 87721bc4b3091ebb06cfaa856da9d9f6829ff299 /llvm/lib/Transforms/Utils/PredicateInfo.cpp | |
parent | fc39a9ca0ef4f7b07c485e0d3c61ec0776f7a38c (diff) | |
download | llvm-b805e944773e119461903e5140389072c02796bf.zip llvm-b805e944773e119461903e5140389072c02796bf.tar.gz llvm-b805e944773e119461903e5140389072c02796bf.tar.bz2 |
[PredicateInfo] Add additional RenamedOp field to PB.
OriginalOp of a predicate always refers to the original IR
value that was renamed. So for nested predicates of the same value, it
will always refer to the original IR value.
For the use in SCCP however, we need to find the renamed value that is
currently used in the condition associated with the predicate. This
patch adds a new RenamedOp field to do exactly that.
NewGVN currently relies on the existing behavior to merge instruction
metadata. A test case to check for exactly that has been added in
195fa4bfae10.
Reviewers: efriedma, davide, nikic
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D78133
Diffstat (limited to 'llvm/lib/Transforms/Utils/PredicateInfo.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/PredicateInfo.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp index 6fba0bc..d320f48 100644 --- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp +++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp @@ -600,6 +600,9 @@ Value *PredicateInfoBuilder::materializeStack(unsigned int &Counter, RenameIter == RenameStack.begin() ? OrigOp : (RenameIter - 1)->Def; ValueDFS &Result = *RenameIter; auto *ValInfo = Result.PInfo; + ValInfo->RenamedOp = (RenameStack.end() - Start) == RenameStack.begin() + ? OrigOp + : (RenameStack.end() - Start - 1)->Def; // For edge predicates, we can just place the operand in the block before // the terminator. For assume, we have to place it right before the assume // to ensure we dominate all of our uses. Always insert right before the |