[llvm] a545c7f - [IR] Use isEntryBlock() API (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 6 06:47:21 PST 2023


Author: Nikita Popov
Date: 2023-01-06T15:44:46+01:00
New Revision: a545c7f4a10ff4a90fcdcbbff2b1e06e397ff2e1

URL: https://github.com/llvm/llvm-project/commit/a545c7f4a10ff4a90fcdcbbff2b1e06e397ff2e1
DIFF: https://github.com/llvm/llvm-project/commit/a545c7f4a10ff4a90fcdcbbff2b1e06e397ff2e1.diff

LOG: [IR] Use isEntryBlock() API (NFC)

Added: 
    

Modified: 
    llvm/lib/IR/Instructions.cpp
    llvm/lib/IR/Verifier.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index d1d7e14454a4..b5575260cab1 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1519,7 +1519,7 @@ bool AllocaInst::isStaticAlloca() const {
 
   // Must be in the entry block.
   const BasicBlock *Parent = getParent();
-  return Parent == &Parent->getParent()->front() && !isUsedWithInAlloca();
+  return Parent->isEntryBlock() && !isUsedWithInAlloca();
 }
 
 //===----------------------------------------------------------------------===//

diff  --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index e4948b1d8280..0067491d9511 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -5250,8 +5250,8 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
     break;
   case Intrinsic::localescape: {
     BasicBlock *BB = Call.getParent();
-    Check(BB == &BB->getParent()->front(),
-          "llvm.localescape used outside of entry block", Call);
+    Check(BB->isEntryBlock(), "llvm.localescape used outside of entry block",
+          Call);
     Check(!SawFrameEscape, "multiple calls to llvm.localescape in one function",
           Call);
     for (Value *Arg : Call.args()) {


        


More information about the llvm-commits mailing list