[llvm] [AArch64] Add CodeGen support for FEAT_CPA (PR #105669)

Jessica Clarke via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 10:11:34 PDT 2024


================
@@ -4081,8 +4087,15 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
       // For PIC, the sequence is:
       // BRIND(load(Jumptable + index) + RelocBase)
       // RelocBase can be JumpTable, GOT or some sort of global base.
-      Addr = DAG.getNode(ISD::ADD, dl, PTy, Addr,
-                          TLI.getPICJumpTableRelocBase(Table, DAG));
+      if (!DAG.getTarget().shouldPreservePtrArith(
+              DAG.getMachineFunction().getFunction())) {
+        Addr = DAG.getNode(ISD::ADD, dl, PTy, Addr,
+                           TLI.getPICJumpTableRelocBase(Table, DAG));
+      } else {
+        // PTRADD always takes the pointer first, so the operands are commuted
----------------
jrtc27 wrote:

Yeah the only reason I did it this way downstream was to avoid test churn by commuting the ADD operands for non-CHERI targets

https://github.com/llvm/llvm-project/pull/105669


More information about the llvm-commits mailing list