Fix bitcode decoder error in "Encode alignment attribute for `atomicrmw`"
authorJames Y Knight <jyknight@google.com>
Fri, 12 Feb 2021 03:26:12 +0000 (22:26 -0500)
committerJames Y Knight <jyknight@google.com>
Fri, 12 Feb 2021 03:29:03 +0000 (22:29 -0500)
The wrong record field number was being used in bitcode decoding,
which broke a self-hosted LTO build. (Yet, somehow, this _doesn't_
seem to have broken simple bitcode encode/decode roundtrip tests, and
I'm not sure why...)

Fixes commit d06ab79816785fa362e7d96d7a398bea8064cba7

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

index 4a77f8c..2911eb5 100644 (file)
@@ -5181,7 +5181,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
       MaybeAlign Alignment;
 
       if (NumRecords == (OpNum + 5)) {
-        if (Error Err = parseAlignmentValue(Record[6], Alignment))
+        if (Error Err = parseAlignmentValue(Record[OpNum + 4], Alignment))
           return Err;
       }