filcab added a comment.

Splitting the attrloc from the useloc might make sense since we would be able 
to emit attrloc just once. But I don't see why we need to store/load those 
pointers in runtime instead of just caching the `Constant*` in 
`CodeGenFunction`.
I'd also like to have some asserts and explicit resets to `nullptr` after use 
on the `ReturnLocation` variable, if possible.



================
Comment at: lib/CodeGen/CGStmt.cpp:1035
+    assert(ReturnLocation.isValid() && "No valid return location");
+    Builder.CreateStore(Builder.CreateBitCast(SLocPtr, Int8PtrTy),
+                        ReturnLocation);
----------------
Can't you just keep the `Constant*` around and use it later for the static 
data? Instead of creating a global var and have runtime store/load?


================
Comment at: lib/CodeGen/CodeGenFunction.h:1412
+  /// source location for diagnostics.
+  Address ReturnLocation = Address::invalid();
+
----------------
Maybe `CurrentReturnLocation`?


https://reviews.llvm.org/D34299



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to