[llvm] b6bf28f - [GVN] No else after return. NFC.
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri May 19 07:17:36 PDT 2023
Author: Jay Foad
Date: 2023-05-19T15:07:31+01:00
New Revision: b6bf28fae34442b21281286a5feda479ce47bce4
URL: https://github.com/llvm/llvm-project/commit/b6bf28fae34442b21281286a5feda479ce47bce4
DIFF: https://github.com/llvm/llvm-project/commit/b6bf28fae34442b21281286a5feda479ce47bce4.diff
LOG: [GVN] No else after return. NFC.
Added:
Modified:
llvm/lib/Transforms/Scalar/GVN.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index 098ea89d170f..3f94cae876a9 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -474,15 +474,17 @@ uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
uint32_t e = assignExpNewValueNum(exp).first;
valueNumbering[C] = e;
return e;
- } else if (MD && AA->onlyReadsMemory(C) &&
- // FIXME: Currently the calls which may access the thread id may
- // be considered as not accessing the memory. But this is
- // problematic for coroutines, since coroutines may resume in a
- //
diff erent thread. So we disable the optimization here for the
- // correctness. However, it may block many other correct
- // optimizations. Revert this one when we detect the memory
- // accessing kind more precisely.
- !C->getFunction()->isPresplitCoroutine()) {
+ }
+
+ if (MD && AA->onlyReadsMemory(C) &&
+ // FIXME: Currently the calls which may access the thread id may
+ // be considered as not accessing the memory. But this is
+ // problematic for coroutines, since coroutines may resume in a
+ //
diff erent thread. So we disable the optimization here for the
+ // correctness. However, it may block many other correct
+ // optimizations. Revert this one when we detect the memory
+ // accessing kind more precisely.
+ !C->getFunction()->isPresplitCoroutine()) {
Expression exp = createExpr(C);
auto ValNum = assignExpNewValueNum(exp);
if (ValNum.second) {
@@ -572,10 +574,10 @@ uint32_t GVNPass::ValueTable::lookupOrAddCall(CallInst *C) {
uint32_t v = lookupOrAdd(cdep);
valueNumbering[C] = v;
return v;
- } else {
- valueNumbering[C] = nextValueNumber;
- return nextValueNumber++;
}
+
+ valueNumbering[C] = nextValueNumber;
+ return nextValueNumber++;
}
/// Returns true if a value number exists for the specified value.
@@ -1924,7 +1926,9 @@ bool GVNPass::processAssumeIntrinsic(AssumeInst *IntrinsicI) {
return true;
}
return false;
- } else if (isa<Constant>(V)) {
+ }
+
+ if (isa<Constant>(V)) {
// If it's not false, and constant, it must evaluate to true. This means our
// assume is assume(true), and thus, pointless, and we don't want to do
// anything more here.
@@ -2557,7 +2561,9 @@ bool GVNPass::processInstruction(Instruction *I) {
// Failure, just remember this instance for future use.
addToLeaderTable(Num, I, I->getParent());
return false;
- } else if (Repl == I) {
+ }
+
+ if (Repl == I) {
// If I was the result of a shortcut PRE, it might already be in the table
// and the best replacement for itself. Nothing to do.
return false;
More information about the llvm-commits
mailing list