Fix bugs in LLVMExtractFirstVectorElement().
When we're manually scalarizing the extraction of the first element of a vector value, we need to be careful about handling constant values and about where new instructions are inserted. The old code was sloppy about this, which in turn lead to invalid IR in some cases. For example, the two bugs below were essentially due to generating an extractelement inst from a zeroinitializer value and then inserting it in the wrong bblock such that a phi node that used that value was malformed. Fixes issues #240 and #229.
This commit is contained in:
@@ -274,8 +274,7 @@ extern void LLVMDumpValue(llvm::Value *v);
|
||||
worth of values just to extract the first element, in cases where only
|
||||
the first element's value is needed.
|
||||
*/
|
||||
extern llvm::Value *LLVMExtractFirstVectorElement(llvm::Value *v,
|
||||
llvm::Instruction *insertBefore);
|
||||
extern llvm::Value *LLVMExtractFirstVectorElement(llvm::Value *v);
|
||||
|
||||
/** This function takes two vectors, expected to be the same length, and
|
||||
returns a new vector of twice the length that represents concatenating
|
||||
|
||||
Reference in New Issue
Block a user