[Attributor] UB Attribute now handles all instructions that access memory through...
authorJohannes Doerfert <johannes@jdoerfert.de>
Wed, 25 Dec 2019 01:25:08 +0000 (19:25 -0600)
committerJohannes Doerfert <johannes@jdoerfert.de>
Wed, 25 Dec 2019 01:25:08 +0000 (19:25 -0600)
commit5732f56bbd28be6cab976e1df0d87ac5ffae7fcd
treedd8cb34c31301a79f2398e177e491df2ea188fdb
parent58f324a468ffc66398199f1a55218e10b718e495
[Attributor] UB Attribute now handles all instructions that access memory through a pointer

Summary:
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?

Reviewers: jdoerfert, sstefan1

Reviewed By: jdoerfert, sstefan1

Subscribers: hiraditya, jfb, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71787
llvm/lib/Transforms/IPO/Attributor.cpp
llvm/test/Transforms/Attributor/undefined_behavior.ll