[PATCH] D103138: [AMDGPU] [IndirectCalls] Don't propagate attributes to address taken functions and their callees
    Jay Foad via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu May 27 02:10:53 PDT 2021
    
    
  
foad added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp:118
 
+  CallGraph *ModuleCG;
+
----------------
Add the nullptr initializion here instead of in the constructor?
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp:248
+
+    std::queue<CallGraphNode *> SubGraph;
+    SubGraph.push(CGN);
----------------
It's more common to use a SmallVector for this, with push_back and pop_back_val.
================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUPropagateAttributes.cpp:234-237
+  if (!ModuleCG) {
+    llvm_unreachable("Call graph not valid");
+    return Changed;
+  }
----------------
madhur13490 wrote:
> arsenm wrote:
> > Just assert, the return is dead
> I'd say its a style choice. Preferring llvm_unreachable over assert.
Then it's a bad choice :) I agree with Matt. `assert(CG)` or `assert(CG && "message")` are shorter and simpler and more familiar because they're already ubiquitous throughout llvm.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103138/new/
https://reviews.llvm.org/D103138
    
    
More information about the llvm-commits
mailing list