[PATCH] D71787: [Attributor] UB Attribute now handles all instructions that access memory through a pointer

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 14:58:54 PST 2019


baziotis created this revision.
baziotis added a reviewer: jdoerfert.
Herald added subscribers: llvm-commits, jfb, hiraditya.
Herald added a reviewer: sstefan1.
Herald added a project: LLVM.

Follow-up on: https://reviews.llvm.org/D71435
We basically use `checkForAllInstructions` to loop through all the instructions in a function that access memory through a pointer: load, store, atomicrmw, atomiccmpxchg
Note that we can now use the `getPointerOperand()` that gets us the pointer operand for an instruction that belongs to the aforementioned set.

Question: This function returns `nullptr` if the instruction is `volatile`. Why?
Guess:  Because if it is volatile, we don't want to do any transformation to it.

Another subtle point is that I had to add AtomicRMW, AtomicCmpXchg to `initializeInformationCache()`. Following `checkAllInstructions()` path, that
seemed the most reasonable place to add it and correct the fact that these instructions were ignored (they were not in `OpcodeInstMap` etc.). Is that ok?


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71787

Files:
  llvm/lib/Transforms/IPO/Attributor.cpp
  llvm/test/Transforms/Attributor/undefined_behavior.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71787.234981.patch
Type: text/x-patch
Size: 9934 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191220/5d044b9a/attachment.bin>


More information about the llvm-commits mailing list