[PATCH] D51560: Make HasWinCFI a plain bool instead of Optional<bool>

Sanjin Sijaric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 15:04:42 PDT 2018


ssijaric created this revision.
ssijaric added reviewers: rnk, mstorsjo, hans.
Herald added a reviewer: javed.absar.
Herald added a subscriber: kristof.beyls.

Reid suggested making HasWinCFI a plain bool defaulting to false in https://reviews.llvm.org/D50288.

It's needed in order to add HasWinCFI to MIRPrinter (https://reviews.llvm.org/D51201 adds HasWinCFI to MIRParser only).  Otherwise, we'll get an assertion

HasWinCFI.hasValue() && "HasWinCFI not set yet!"'

Also, a few ARM64 Windows test cases will fail with the same assert if the ARM64 MCLayer part (https://reviews.llvm.org/D50166) goes in before the frame lowering part that sets HasWinCFI (https://reviews.llvm.org/D50288 as of now).


Repository:
  rL LLVM

https://reviews.llvm.org/D51560

Files:
  include/llvm/CodeGen/MachineFunction.h


Index: include/llvm/CodeGen/MachineFunction.h
===================================================================
--- include/llvm/CodeGen/MachineFunction.h
+++ include/llvm/CodeGen/MachineFunction.h
@@ -294,7 +294,7 @@
   bool HasInlineAsm = false;
 
   /// True if any WinCFI instruction have been emitted in this function.
-  Optional<bool> HasWinCFI;
+  bool HasWinCFI = false;
 
   /// Current high-level properties of the IR of the function (e.g. is in SSA
   /// form or whether registers have been allocated)
@@ -484,8 +484,7 @@
   }
 
   bool hasWinCFI() const {
-    assert(HasWinCFI.hasValue() && "HasWinCFI not set yet!");
-    return *HasWinCFI;
+    return HasWinCFI;
   }
   void setHasWinCFI(bool v) { HasWinCFI = v; }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51560.163599.patch
Type: text/x-patch
Size: 737 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180831/310c13cc/attachment.bin>


More information about the llvm-commits mailing list