[llvm] 46d7876 - Follow up to 6b62a9135a2, fix llvm-examples build

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 05:43:38 PST 2024


Author: Jeremy Morse
Date: 2024-03-04T13:41:26Z
New Revision: 46d7876957deb817b48a5fa8a854b5a47a6a0653

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

LOG: Follow up to 6b62a9135a2, fix llvm-examples build

This is due to the {I,F}CmpInst constructor being normalised to take a
pointer to a block rather than a reference (unlike any other Instruction).

Added: 
    

Modified: 
    llvm/examples/BrainF/BrainF.cpp
    llvm/examples/Fibonacci/fibonacci.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp
index 53db48be04ac91..1c7cacba4fff89 100644
--- a/llvm/examples/BrainF/BrainF.cpp
+++ b/llvm/examples/BrainF/BrainF.cpp
@@ -440,7 +440,7 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb,
       LoadInst *tape_0 = new LoadInst(Int8Ty, head_0, tapereg, testbb);
 
       //%test.%d = icmp eq i8 %tape.%d, 0
-      ICmpInst *test_0 = new ICmpInst(*testbb, ICmpInst::ICMP_EQ, tape_0,
+      ICmpInst *test_0 = new ICmpInst(testbb, ICmpInst::ICMP_EQ, tape_0,
                                     ConstantInt::get(C, APInt(8, 0)), testreg);
 
       //br i1 %test.%d, label %main.%d, label %main.%d

diff  --git a/llvm/examples/Fibonacci/fibonacci.cpp b/llvm/examples/Fibonacci/fibonacci.cpp
index 12393a414d0746..a3bbe5b5a004fc 100644
--- a/llvm/examples/Fibonacci/fibonacci.cpp
+++ b/llvm/examples/Fibonacci/fibonacci.cpp
@@ -73,7 +73,7 @@ static Function *CreateFibFunction(Module *M, LLVMContext &Context) {
   BasicBlock* RecurseBB = BasicBlock::Create(Context, "recurse", FibF);
 
   // Create the "if (arg <= 2) goto exitbb"
-  Value *CondInst = new ICmpInst(*BB, ICmpInst::ICMP_SLE, ArgX, Two, "cond");
+  Value *CondInst = new ICmpInst(BB, ICmpInst::ICMP_SLE, ArgX, Two, "cond");
   BranchInst::Create(RetBB, RecurseBB, CondInst, BB);
 
   // Create: ret int 1


        


More information about the llvm-commits mailing list