Open Quuxplusone opened 6 months ago
This looks like a plausible patch:
--- a/llvm/lib/IR/Operator.cpp
+++ b/llvm/lib/IR/Operator.cpp
@@ -19,7 +19,8 @@
namespace llvm {
bool Operator::hasPoisonGeneratingFlags() const {
- switch (getOpcode()) {
+ unsigned opc = isa<Instruction>(this) ? getOpcode() : unsigned(-1);
+ switch (opc) {
case Instruction::Add:
case Instruction::Sub:
case Instruction::Mul:
https://godbolt.org/z/ebebYdjof
Compile with
clang++ -O2
and it ICEs. Interestingly, it ICEs only in C++, not in C. Started happening sometime after Clang 18. It looks likeisGuaranteedNotToBeUndefOrPoison
has been touched a lot in March 2024, so that's probably all it is.