[llvm] 1ebbf84 - [NFC][IR] PHINode: assert we aren't trying to create token-typed PHI

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 27 10:49:56 PDT 2021


Author: Roman Lebedev
Date: 2021-04-27T20:49:42+03:00
New Revision: 1ebbf84ba45b1af8b6469f79a6c6798d185bc1d2

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

LOG: [NFC][IR] PHINode: assert we aren't trying to create token-typed PHI

Verifier will complain, but by then it may be too late,
because we might have never reached it because
we already crashed with some bogus bug.
It is best to catch this the moment it happens.

Added: 
    

Modified: 
    llvm/include/llvm/IR/Instructions.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Instructions.h b/llvm/include/llvm/IR/Instructions.h
index 14ba509f424e7..650746c028383 100644
--- a/llvm/include/llvm/IR/Instructions.h
+++ b/llvm/include/llvm/IR/Instructions.h
@@ -2583,6 +2583,7 @@ class PHINode : public Instruction {
                    Instruction *InsertBefore = nullptr)
     : Instruction(Ty, Instruction::PHI, nullptr, 0, InsertBefore),
       ReservedSpace(NumReservedValues) {
+    assert(!Ty->isTokenTy() && "PHI nodes cannot have token type!");
     setName(NameStr);
     allocHungoffUses(ReservedSpace);
   }


        


More information about the llvm-commits mailing list