[PATCH] D156556: [AggressiveInstCombine][NFC] Fix typo
Maksim Kita via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 7 11:58:58 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5dde755188e3: [AggressiveInstCombine][NFC] Fix typo (authored by kitaisreal).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156556/new/
https://reviews.llvm.org/D156556
Files:
llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
Index: llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
===================================================================
--- llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
+++ llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp
@@ -934,13 +934,8 @@
size_t ConstantStrSize = ConstantStr.size();
// Trivial cases are optimized during inst combine
- if (ConstantStrSize == 0) {
+ if (ConstantStrSize == 0 || ConstantStrSize > 2)
return false;
- }
-
- if (ConstantStrSize > 2) {
- return false;
- }
// Check if strcmp result is only used in a comparison with zero
if (!isOnlyUsedInZeroComparison(CI))
@@ -960,7 +955,7 @@
// For strcmp(P, "xy") do the following transformation:
//
// (before)
- // dst = strcmp(P, "x")
+ // dst = strcmp(P, "xy")
//
// (after)
// v0 = P[0] - 'x'
@@ -1000,19 +995,19 @@
static_cast<unsigned char>(ConstantStr[CharacterIndexToCheck]));
Value *CharacterSub =
B.CreateNSWSub(StrCharacterValue, ConstantStrCharacterValue);
- Value *IsCharacterSubZero =
+ Value *CharacterSubIsZero =
B.CreateICmpEQ(CharacterSub, ConstantInt::get(RetType, 0));
- BasicBlock *IsCharacterSubZeroBB =
+ BasicBlock *CharacterSubIsZeroBB =
BasicBlock::Create(B.getContext(), "strcmp_expand_sub_is_zero",
InitialBB->getParent(), JoinBlock);
- B.CreateCondBr(IsCharacterSubZero, IsCharacterSubZeroBB, JoinBlock);
+ B.CreateCondBr(CharacterSubIsZero, CharacterSubIsZeroBB, JoinBlock);
ResultPHI->addIncoming(CharacterSub, B.GetInsertBlock());
DTUpdates.emplace_back(DominatorTree::Insert, B.GetInsertBlock(),
- IsCharacterSubZeroBB);
+ CharacterSubIsZeroBB);
- B.SetInsertPoint(IsCharacterSubZeroBB);
- DTUpdates.emplace_back(DominatorTree::Insert, IsCharacterSubZeroBB,
+ B.SetInsertPoint(CharacterSubIsZeroBB);
+ DTUpdates.emplace_back(DominatorTree::Insert, CharacterSubIsZeroBB,
JoinBlock);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156556.547896.patch
Type: text/x-patch
Size: 2100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230807/b8e09fab/attachment.bin>
More information about the cfe-commits
mailing list