[llvm] [IR] Add `samesign` flag to icmp instruction (PR #111419)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 13:44:15 PDT 2024


================
@@ -5482,6 +5482,8 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
         if (!CmpInst::isIntPredicate(PredVal))
           return error("Invalid icmp predicate");
         I = new ICmpInst(PredVal, LHS, RHS);
+        if (Record[OpNum] & (1 << bitc::PSSI_SAME_SIGN))
+          cast<ICmpInst>(I)->setSameSign(true);
----------------
elhewaty wrote:

So the record size needs to be greater than the number of operands this means that the record has operands and flags?

```
if (Record.size() > OpNum+1 && (Record[OpNum] & (1 << bitc::ICMP_SAME_SIGN)))
          cast<ICmpInst>(I)->setSameSign();
```

https://github.com/llvm/llvm-project/pull/111419


More information about the llvm-commits mailing list