[llvm-branch-commits] [llvm] MachineVerifier: Check stack protector is top-most in frame (PR #122635)

2025-01-12 Thread Guy David via llvm-branch-commits

https://github.com/guy-david edited 
https://github.com/llvm/llvm-project/pull/122635
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [AddressSanitizer] Remove memory effects from functions (PR #130495)

2025-03-12 Thread Guy David via llvm-branch-commits

https://github.com/guy-david edited 
https://github.com/llvm/llvm-project/pull/130495
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [AddressSanitizer] Remove memory effects from functions (PR #130495)

2025-03-12 Thread Guy David via llvm-branch-commits

https://github.com/guy-david edited 
https://github.com/llvm/llvm-project/pull/130495
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [AddressSanitizer] Remove memory effects from functions (PR #130495)

2025-03-12 Thread Guy David via llvm-branch-commits


@@ -612,6 +612,48 @@ void getAddressSanitizerParams(const Triple &TargetTriple, 
int LongSize,
   *OrShadowOffset = Mapping.OrShadowOffset;
 }
 
+void removeASanIncompatibleFnAttributes(Function &F, bool RemoveWriteOnly) {
+  // Remove memory attributes that are invalid with ASan and HWSan.
+  // ASan checks read from shadow, which invalidates memory(argmem: *)
+  // Short granule checks on function arguments read from the argument memory
+  // (last byte of the granule), which invalidates writeonly.
+  //
+  // This is not only true for sanitized functions, because AttrInfer can
+  // infer those attributes on libc functions, which is not true if those
+  // are instrumented (Android) or intercepted.
+  //
+  // We might want to model ASan shadow memory more opaquely to get rid of
+  // this problem altogether, by hiding the shadow memory write in an
+  // intrinsic, essentially like in the AArch64StackTagging pass. But that's
+  // for another day.
+
+  // The API is weird. `onlyReadsMemory` actually means "does not write", and
+  // `onlyWritesMemory` actually means "does not read". So we reconstruct
+  // "accesses memory" && "does not read" <=> "writes".
+  bool Changed = false;
+  if (!F.doesNotAccessMemory()) {
+bool WritesMemory = !F.onlyReadsMemory();
+bool ReadsMemory = !F.onlyWritesMemory();
+if ((WritesMemory && !ReadsMemory) || F.onlyAccessesArgMemory()) {
+  F.removeFnAttr(Attribute::Memory);
+  Changed = true;
+}
+  }
+  if (RemoveWriteOnly) {
+for (Argument &A : F.args()) {
+  if (A.hasAttribute(Attribute::WriteOnly)) {
+A.removeAttr(Attribute::WriteOnly);
+Changed = true;
+  }
+}
+  }
+  if (Changed) {
+// nobuiltin makes sure later passes don't restore assumptions about
+// the function.
+F.addFnAttr(Attribute::NoBuiltin);
+  }
+}

guy-david wrote:

I'm not completely following, can you explain what it means to "operate in 
terms of Memory"?

https://github.com/llvm/llvm-project/pull/130495
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [MachineSink] Lower SplitEdgeProbabilityThreshold (PR #127666)

2025-02-25 Thread Guy David via llvm-branch-commits

https://github.com/guy-david edited 
https://github.com/llvm/llvm-project/pull/127666
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [MachineSink] Lower SplitEdgeProbabilityThreshold (PR #127666)

2025-02-25 Thread Guy David via llvm-branch-commits

https://github.com/guy-david edited 
https://github.com/llvm/llvm-project/pull/127666
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [PHIElimination] Reuse existing COPY in predecessor basic block (Take Two) (PR #146806)

2025-07-03 Thread Guy David via llvm-branch-commits

guy-david wrote:

@mikaelholmen @mstorsjo @macurtis-amd @sjoerdmeijer @sushgokh
We've decided that it's best to revert the original PR (see 
https://github.com/llvm/llvm-project/pull/146850), sorry for wasting your time.
This PR is trying to reintroduce it with fixes to the issues you've presented. 
Can I humbly ask you to test this commit one final time?

https://github.com/llvm/llvm-project/pull/146806
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [PHIElimination] Reuse existing COPY in predecessor basic block (Take Two) (PR #146806)

2025-07-03 Thread Guy David via llvm-branch-commits

https://github.com/guy-david edited 
https://github.com/llvm/llvm-project/pull/146806
___
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits