================
@@ -1699,8 +1701,12 @@ Expected<Value *> 
BitcodeReader::materializeValue(unsigned StartValID,
         I = GetElementPtrInst::Create(BC->SrcElemTy, Ops[0],
                                       ArrayRef(Ops).drop_front(), "constexpr",
                                       InsertBB);
-        if (BC->Flags)
+        if (BC->Flags & (1 << bitc::GEP_INBOUNDS))
           cast<GetElementPtrInst>(I)->setIsInBounds();
+        if (BC->Flags & (1 << bitc::GEP_NUSW))
----------------
nikic wrote:

I think using `else if` would be correct here as `setIsInBounds` will also set 
nusw by itself, but keeping all cases separate seems cleaner?

Otherwise we'll have the following code here...
```
        if (BC->Flags & (1 << bitc::GEP_INBOUNDS))
          cast<GetElementPtrInst>(I)->setIsInBounds();
        else if (BC->Flags & (1 << bitc::GEP_NUSW))
          cast<GetElementPtrInst>(I)->setHasNoUnsignedSignedWrap();
        if (BC->Flags & (1 << bitc::GEP_NUW))
          cast<GetElementPtrInst>(I)->setHasNoUnsignedWrap();
```
...at which point it will probably need a comment to explain why there is only 
one `else if` there.

https://github.com/llvm/llvm-project/pull/90824
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to