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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 14:17:11 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);
----------------
nikic wrote:

Basically yes, but the flags will be at Record[OpNum+1] and also you'll trip the preceding `OpNum+1 != Record.size()` check if you do it like this. Instead you should check this at the same place where FMF is set.

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


More information about the llvm-commits mailing list