[PATCH] D56038: hwasan: Implement lazy thread initialization for the interceptor ABI.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 4 10:50:18 PST 2019


pcc added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:827
+    IRB.CreateCall(HwasanThreadEnterFunc);
+    LoadInst *ReloadThreadLong = IRB.CreateLoad(SlotPtr);
+
----------------
eugenis wrote:
> This could jump back to the earlier load to save an instruction (at the cost of one extra not-taken branch on the slow path).
> 
> Or even better, return the new value from the custom calling convention variant of __hwasan_thread_enter. Not in this change, of course.
> 
You're right that it could jump back, but I think that I'd prefer not to add this complexity just to remove it later when we switch to the new calling convention.

And yes, the function with the new calling convention would return the thread long value. On ARM64 the code would look like this:

```
ldr x9, [x9, #64]
cbz .Linit
.Lcont:
...

.Linit:
bl __hwasan_lazy_thread_enter # returns in x9
b .Lcont
```


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56038/new/

https://reviews.llvm.org/D56038





More information about the llvm-commits mailing list